From 1a298e4e06e6b6eeb92e526a04a6fde2525a6a4e Mon Sep 17 00:00:00 2001 From: Robert Gerus Date: Sat, 12 Dec 2015 13:01:17 +0100 Subject: [PATCH] Adjust bot to changes in config. Temporarily disable jan and papiez plugins until. --- bot/bot.go | 11 +++++++++++ bot/channeljoin.go | 1 - bot/dispatcher.go | 1 - bot/helpers.go | 1 - bot/identify.go | 1 - bot/jan.go | 3 ++- bot/nickserv.go | 1 - bot/papiez.go | 3 ++- bot/plugins_test.go | 11 +++++++---- bot/seen.go | 1 - bot/urltitle.go | 1 - 11 files changed, 22 insertions(+), 13 deletions(-) create mode 100644 bot/bot.go diff --git a/bot/bot.go b/bot/bot.go new file mode 100644 index 0000000..9d136d6 --- /dev/null +++ b/bot/bot.go @@ -0,0 +1,11 @@ +package bot + +import ( + "github.com/arachnist/gorepost/config" +) + +var cfg *config.Config + +func Initialize(config *config.Config) { + cfg = config +} diff --git a/bot/channeljoin.go b/bot/channeljoin.go index 63e5339..6aa0df7 100644 --- a/bot/channeljoin.go +++ b/bot/channeljoin.go @@ -7,7 +7,6 @@ package bot import ( "log" - cfg "github.com/arachnist/gorepost/config" "github.com/arachnist/gorepost/irc" ) diff --git a/bot/dispatcher.go b/bot/dispatcher.go index 0be2a68..7534f8c 100644 --- a/bot/dispatcher.go +++ b/bot/dispatcher.go @@ -9,7 +9,6 @@ import ( "strings" "sync" - cfg "github.com/arachnist/gorepost/config" "github.com/arachnist/gorepost/irc" ) diff --git a/bot/helpers.go b/bot/helpers.go index abe2c12..3e073e3 100644 --- a/bot/helpers.go +++ b/bot/helpers.go @@ -15,7 +15,6 @@ import ( "github.com/moovweb/gokogiri" "github.com/moovweb/gokogiri/xpath" - cfg "github.com/arachnist/gorepost/config" "github.com/arachnist/gorepost/irc" ) diff --git a/bot/identify.go b/bot/identify.go index f81c92a..04ef61d 100644 --- a/bot/identify.go +++ b/bot/identify.go @@ -7,7 +7,6 @@ package bot import ( "strings" - cfg "github.com/arachnist/gorepost/config" "github.com/arachnist/gorepost/irc" ) diff --git a/bot/jan.go b/bot/jan.go index 2feb0eb..66ce125 100644 --- a/bot/jan.go +++ b/bot/jan.go @@ -1,3 +1,5 @@ +// +build configfix +// // Copyright 2015 Robert S. Gerus. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. @@ -11,7 +13,6 @@ import ( "sync" "time" - cfg "github.com/arachnist/gorepost/config" "github.com/arachnist/gorepost/irc" ) diff --git a/bot/nickserv.go b/bot/nickserv.go index 48200b4..b2c5915 100644 --- a/bot/nickserv.go +++ b/bot/nickserv.go @@ -9,7 +9,6 @@ import ( "log" "regexp" - cfg "github.com/arachnist/gorepost/config" "github.com/arachnist/gorepost/irc" ) diff --git a/bot/papiez.go b/bot/papiez.go index ca573f0..4e68586 100644 --- a/bot/papiez.go +++ b/bot/papiez.go @@ -1,3 +1,5 @@ +// +build configfix +// // Copyright 2015 Robert S. Gerus. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. @@ -11,7 +13,6 @@ import ( "sync" "time" - cfg "github.com/arachnist/gorepost/config" "github.com/arachnist/gorepost/irc" ) diff --git a/bot/plugins_test.go b/bot/plugins_test.go index 2b07cee..4f26abe 100644 --- a/bot/plugins_test.go +++ b/bot/plugins_test.go @@ -16,7 +16,7 @@ import ( "testing" "time" - cfg "github.com/arachnist/gorepost/config" + "github.com/arachnist/gorepost/config" "github.com/arachnist/gorepost/irc" ) @@ -257,7 +257,7 @@ var eventTests = []struct { }, }, }, - { + /* { desc: "papież", in: irc.Message{ Command: "PRIVMSG", @@ -336,7 +336,7 @@ var eventTests = []struct { Trailing: "Jan Paweł II predicate małe specified-object", }, }, - }, + }, */ { desc: "roll multiple", in: irc.Message{ @@ -815,6 +815,9 @@ func configLookupHelper(map[string]string) []string { func TestMain(m *testing.M) { log.SetOutput(ioutil.Discard) - cfg.SetFileListBuilder(configLookupHelper) os.Exit(m.Run()) } + +func init() { + Initialize(config.New(configLookupHelper)) +} diff --git a/bot/seen.go b/bot/seen.go index 2bbd5d8..0bb4e1d 100644 --- a/bot/seen.go +++ b/bot/seen.go @@ -13,7 +13,6 @@ import ( "github.com/cloudflare/gokabinet/kt" - cfg "github.com/arachnist/gorepost/config" "github.com/arachnist/gorepost/irc" ) diff --git a/bot/urltitle.go b/bot/urltitle.go index 9134012..f29fa21 100644 --- a/bot/urltitle.go +++ b/bot/urltitle.go @@ -12,7 +12,6 @@ import ( "strings" "unicode/utf8" - cfg "github.com/arachnist/gorepost/config" "github.com/arachnist/gorepost/irc" )