From 4395e0afb0c3f087affafbe925a2ea2fb9b4bd5c Mon Sep 17 00:00:00 2001 From: khuxkm fbexl Date: Sat, 1 Dec 2018 20:00:00 -0500 Subject: [PATCH] Add on_connection_established callback --- teambot/bot.py | 3 +++ teambot/handler.py | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/teambot/bot.py b/teambot/bot.py index 2e0ab8d..b76beec 100644 --- a/teambot/bot.py +++ b/teambot/bot.py @@ -23,6 +23,8 @@ class TeamBot(irc.bot.SingleServerIRCBot): ## Joins the supplied channels and stores the connection object. # + # Also sets mode +B and trips Handler.on_connection_established callback. + # # @param self The bot object. # @param conn The connection object. Stored in self.conn after this. # @param event The welcome event. Unused. @@ -31,6 +33,7 @@ class TeamBot(irc.bot.SingleServerIRCBot): conn.join(channel) self.conn = conn self.conn.mode(self.bot_nick,"+B") + self.handler.on_connection_established() ## Called when a message is sent in a public channel. # diff --git a/teambot/handler.py b/teambot/handler.py index 884047c..ff02edf 100644 --- a/teambot/handler.py +++ b/teambot/handler.py @@ -9,6 +9,12 @@ class Handler: def __init__(self,bot): self._bot = bot # save bot instance + ## Called when the bot successfully connects to the server. + # + # @param self The handler object + def on_connection_established(self): + pass + ## Called when a message is sent in a public channel. # # @param self The handler object