async def on_message(self, prot: IRCProtocol, msg: Message): self.network.feed_message(msg) if msg.isnumeric('001'): prot.sendline('JOIN #botted') prot.loop.call_later( 15, prot.sendline, 'PRIVMSG #botted :waited for ' '15 seconds to say something! o/') if isinstance(msg, Privmsg): if msg.message == '+test': prot.sendline('QUIT :quitting you bastard!' .format(msg.sender)) elif msg.message == '+cycle': if is_channel(msg.target): prot.sendline('PART {} :Cycling! Because I can!' .format(msg.target)) prot.sendline('JOIN {}'.format(msg.target)) elif msg.message.startswith('+'): return if is_channel(msg.target) and \ ('http://' in msg.message or 'https://' in msg.message)\ and not msg.message.startswith('+'): def replace_url(match): the_url, = match.groups('url') return '\x0304\x02{}\x0F'.format(the_url) text = utils.url_pattern.sub(replace_url, msg.message) prot.sendline('PRIVMSG {} :Matched: {}' .format(msg.target, text)) if isinstance(msg, CtcpRequest): if msg.ctcp_command == 'VERSION': prot.sendline('NOTICE {} :\x01VERSION {}\x01' .format(msg.sender, 'Shanghai Doll 0.1dev'))