allow : and , after @bot mentions

This commit is contained in:
2023-02-19 22:55:14 -06:00
parent 55d856b8fd
commit 39290fb63c
4 changed files with 28 additions and 3 deletions

View File

@@ -72,6 +72,17 @@ class DrReactorTestCase(TestCase):
self.assertTrue(mock_event.addressed)
def test_handle_event_bridge_addressed_alternate_with_colon(self):
"""Test that the core identifies being addressed in the alternate style through a discord bridge."""
mock_event = mock.MagicMock()
mock_event.arguments = ['<someone> @test_bot: hello this is a test message']
mock_event.type = 'pubmsg'
mock_event.target = '#test'
mock_event.source = 'bridge!bridge@localhost'
self.bot._handle_event(self.mock_connection, mock_event)
self.assertTrue(mock_event.addressed)
def test_handle_event_not_addressed_not_bridge(self):
"""Test that the core identifies not to chop the first word from a paste not from the bridge user."""
mock_event = mock.MagicMock()

View File

@@ -118,6 +118,20 @@ class MarkovTestCase(TestCase):
self.assertEqual(mock_learn_line.call_args.args[0], 'hello this is a test message')
def test_learn_bridge_and_variant_with_colon_self_edit(self):
"""Test that we don't learn our own name when learning something addressed to us, discord style."""
mock_event = mock.MagicMock()
mock_event.arguments = ['<tester> @test_bot: hello this is a test message']
mock_event.target = '#test'
mock_event.recursing = False
mock_event.source = 'bridge!bridge@localhost'
with mock.patch('markov.lib.learn_line') as mock_learn_line:
with mock.patch('markov.lib.generate_line'):
self.plugin.handle_chatter(self.mock_connection, mock_event)
self.assertEqual(mock_learn_line.call_args.args[0], 'hello this is a test message')
def test_autocreate_ircchannel(self):
"""Test that we create the necessary config objects when seeing a target for the first time."""
self.assertEqual(IrcChannel.objects.filter(name='#fakechannel').count(), 0)