Skip to content

Commit e43d73e

Browse files
committed
Notify the IRC channel of loaded plugins
1 parent d2b2356 commit e43d73e

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

cmd/quaridirc/main.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ func main() {
2626
c.GetBool("irc.tls.verify"),
2727
)
2828

29+
plugins, err := plugin.LoadPlugins(c.GetStringSlice("plugins_dirs"))
30+
if err != nil {
31+
logrus.Fatalf("error loading plugins: %s", err)
32+
}
33+
2934
a.Handle(
3035
[]adapter.Filter{
3136
adapter.IRCFilter{
@@ -45,6 +50,11 @@ func main() {
4550
Command: irc.IRC_JOIN,
4651
Parameters: c.GetStringSlice("irc.channels"),
4752
})
53+
54+
r.Write(&adapter.Event{
55+
Command: irc.IRC_PRIVMSG,
56+
Parameters: append(c.GetStringSlice("irc.channels"), fmt.Sprintf("hello, I have %d plugins loaded", len(plugins))),
57+
})
4858
},
4959
)
5060

@@ -70,13 +80,6 @@ func main() {
7080

7181
ircbot := bot.New([]adapter.Adapter{a})
7282

73-
plugins, err := plugin.LoadPlugins(c.GetStringSlice("plugin_dirs"))
74-
if err != nil {
75-
logrus.Fatalf("error loading plugins: %s", err)
76-
}
77-
78-
fmt.Printf("%# v", plugins)
79-
8083
errCh := make(chan error)
8184
go start(ircbot, errCh)
8285

0 commit comments

Comments
 (0)