-
Notifications
You must be signed in to change notification settings - Fork 8
/
examplebot.go
111 lines (105 loc) · 3.55 KB
/
examplebot.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// Go IRC Bot example.
package main
import (
"flag"
"log"
"strings"
"github.com/StalkR/goircbot/bot"
"github.com/StalkR/goircbot/lib/size"
"github.com/StalkR/goircbot/plugins/admin"
"github.com/StalkR/goircbot/plugins/asm"
"github.com/StalkR/goircbot/plugins/cdecl"
"github.com/StalkR/goircbot/plugins/coin"
"github.com/StalkR/goircbot/plugins/darkstat"
"github.com/StalkR/goircbot/plugins/df"
"github.com/StalkR/goircbot/plugins/dl"
"github.com/StalkR/goircbot/plugins/dns"
"github.com/StalkR/goircbot/plugins/dnssec"
"github.com/StalkR/goircbot/plugins/errors"
"github.com/StalkR/goircbot/plugins/failotron"
"github.com/StalkR/goircbot/plugins/git"
"github.com/StalkR/goircbot/plugins/golang"
"github.com/StalkR/goircbot/plugins/idle"
"github.com/StalkR/goircbot/plugins/imdb"
"github.com/StalkR/goircbot/plugins/invite"
"github.com/StalkR/goircbot/plugins/mac"
"github.com/StalkR/goircbot/plugins/metal"
"github.com/StalkR/goircbot/plugins/old"
"github.com/StalkR/goircbot/plugins/ping"
"github.com/StalkR/goircbot/plugins/quotes"
"github.com/StalkR/goircbot/plugins/renick"
"github.com/StalkR/goircbot/plugins/scores"
"github.com/StalkR/goircbot/plugins/search"
"github.com/StalkR/goircbot/plugins/sed"
"github.com/StalkR/goircbot/plugins/stock"
"github.com/StalkR/goircbot/plugins/tail"
"github.com/StalkR/goircbot/plugins/timezone"
"github.com/StalkR/goircbot/plugins/tor"
"github.com/StalkR/goircbot/plugins/translate"
"github.com/StalkR/goircbot/plugins/up"
"github.com/StalkR/goircbot/plugins/urban"
"github.com/StalkR/goircbot/plugins/urltitle"
"github.com/StalkR/goircbot/plugins/weather"
"github.com/StalkR/goircbot/plugins/whoami"
"github.com/fluffle/goirc/logging/glog"
)
var (
host = flag.String("host", "irc.example.com", "Server host[:port]")
ssl = flag.Bool("ssl", true, "Enable SSL")
nick = flag.String("nick", "goircbot", "Bot nick")
ident = flag.String("ident", "goircbot", "Bot ident")
channels = flag.String("channels", "", "Channels to join (separated by comma)")
commandPrefix = flag.String("command-prefix", "!", "Command prefix")
ignore = []string{"bot"}
)
func main() {
flag.Parse()
glog.Init()
b, err := bot.NewBotOptions(bot.Host(*host), bot.Nick(*nick), bot.SSL(*ssl), bot.Ident(*ident),
bot.Channels(strings.Split(*channels, ",")),
bot.CommandPrefix(*commandPrefix))
if err != nil {
log.Fatalf("failed to init new bot: %v", err)
}
admin.Register(b, []string{"nick!ident@host"})
asm.Register(b)
cdecl.Register(b)
coin.Register(b, "<key>")
darkstat.Register(b, map[string]string{
"public": "http://darkstat.public.com",
"private": "https://user:[email protected]",
})
df.Register(b, df.NewAlarm(`/`, 10*size.GB))
dl.Register(b, "", "")
dns.Register(b)
dnssec.Register(b)
errors.Register(b)
failotron.Register(b, ignore)
git.Register(b, map[string]string{
"linux": "https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/log/",
})
golang.Register(b)
idle.Register(b, ignore)
imdb.Register(b)
invite.Register(b)
mac.Register(b)
metal.Register(b)
old.Register(b, "/tmp/old", ignore)
ping.Register(b)
quotes.Register(b, "/tmp/quotes")
renick.Register(b, *nick)
scores.Register(b, "/tmp/scores")
search.Register(b, "<key>", "<cx>")
sed.Register(b)
stock.Register(b, "<key>")
tail.Register(b, []string{"/etc/passwd"})
timezone.Register(b, "<username>")
tor.Register(b, "127.0.0.1:9051", "secret")
translate.Register(b, "<key>")
up.Register(b)
urban.Register(b)
urltitle.Register(b, ignore)
weather.Register(b, "<key>")
whoami.Register(b)
b.Run()
}