summaryrefslogtreecommitdiffstats
path: root/wat/bot.go
diff options
context:
space:
mode:
Diffstat (limited to 'wat/bot.go')
-rw-r--r--wat/bot.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/wat/bot.go b/wat/bot.go
index a555de4..41c030f 100644
--- a/wat/bot.go
+++ b/wat/bot.go
@@ -13,11 +13,14 @@ type WatBot struct {
conn *tls.Conn
c *WatConfig
game *WatGame
+ integration *WatIntegration
Db *WatDb
Nick string
}
type WatConfig struct {
+ BotHosts []string
+ BotGames BotGameConfig
AdminHosts []string
IgnoredHosts []string
AutoJoinChannels []string
@@ -28,6 +31,7 @@ func NewWatBot(config *irc.ClientConfig, watConfig *WatConfig, serverConn *tls.C
wat := WatBot{conn: serverConn, Nick: config.Nick, c: watConfig}
wat.Db = NewWatDb()
wat.game = NewWatGame(&wat, wat.Db)
+ wat.integration = NewWatIntegration(&wat, wat.Db, &WatIntegrationConfig{BotHosts: watConfig.BotHosts, BotGames: watConfig.BotGames})
config.Handler = irc.HandlerFunc(wat.HandleIrcMsg)
wat.client = irc.NewClient(wat.conn, *config)
return &wat
@@ -123,6 +127,11 @@ func (w *WatBot) Msg(m *irc.Message) {
args = args[1:]
}
+ // integration with games in other bots
+ if w.integration.HandleIntegration(m, args) {
+ return
+ }
+
// check if command char (or something weird) is present
if args[0] != "wat" && args[0][0] != '#' {
return