From ace82e49e5112f43fa288ca904c97f2a0a6825e3 Mon Sep 17 00:00:00 2001 From: jesopo Date: Sun, 15 Jul 2018 14:13:51 +0100 Subject: [PATCH] Send events when BitBot sends a PRIVMSG --- IRCServer.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/IRCServer.py b/IRCServer.py index 1ee0d5ed..1d525751 100644 --- a/IRCServer.py +++ b/IRCServer.py @@ -253,10 +253,20 @@ class Server(object): if action: message = full_message.split("\01ACTION ", 1)[1][:-1] + full_message_split = full_message.split() if self.has_channel(target): - self.get_channel(target).log.add_line(None, message, action, True) + channel = self.get_channel(target) + channel.log.add_line(None, message, action, True) + self.bot.events.on("self").on("message").on("channel").call( + message=full_message, message_split=full_message_split, + channel=channel, action=action, server=self) else: - self.get_user(target).log.add_line(None, message, action, True) + user = self.get_user(target) + user.log.add_line(None, message, action, True) + self.bot.events.on("self").on("message").on("private").call( + message=full_message, message_split=full_message_split, + user=user, action=action, server=self) + def send_notice(self, target, message): self.send("NOTICE %s :%s" % (target, message))