def test_removing_formatting(self): self.assertEqual(formatting.remove_formatting_codes('Lol \x03cool \x032tests\x0f!', irc=True), 'Lol cool tests!') self.assertEqual(formatting.remove_formatting_codes('Lol $c[]cool $c[blue]tests$r!'), 'Lol cool tests!') self.assertEqual(formatting.remove_formatting_codes('Lol $ccoo$c3,15l $c12,15tests$r!$$y'), 'Lol cool tests!$y') self.assertEqual(formatting.remove_formatting_codes('Lol co${yolo}ol ${$}tests!$'), 'Lol cool $tests!')
def handle_reactor_pubactions(self, event): if event['source'].is_me: return if event['target'].name in self.dispatch_channels: info = { 'type': 'message', 'service': 'irc', 'channel': event['channel'], 'source': event['source'], 'message': remove_formatting_codes(event['message']), } self.events.dispatch('irc action', info)