Add on_connection_established callback

This commit is contained in:
Robert Miles 2018-12-01 20:00:00 -05:00
parent 9805aa4edc
commit 4395e0afb0
2 changed files with 9 additions and 0 deletions

View File

@ -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.
#

View File

@ -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