This repository has been archived by the owner on Mar 11, 2024. It is now read-only.
/
main.go
73 lines (65 loc) · 1.84 KB
/
main.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
package main
import (
"bufio"
"fmt"
"os"
"github.com/go-chat-bot/bot"
_ "github.com/go-chat-bot/plugins-br/cnpj"
_ "github.com/go-chat-bot/plugins-br/cotacao"
_ "github.com/go-chat-bot/plugins-br/cpf"
_ "github.com/go-chat-bot/plugins-br/dilma"
_ "github.com/go-chat-bot/plugins-br/lula"
_ "github.com/go-chat-bot/plugins-br/megasena"
_ "github.com/go-chat-bot/plugins/9gag"
_ "github.com/go-chat-bot/plugins/catfacts"
_ "github.com/go-chat-bot/plugins/catgif"
_ "github.com/go-chat-bot/plugins/chucknorris"
_ "github.com/go-chat-bot/plugins-br/gloria_a_deus"
_ "github.com/go-chat-bot/plugins/cmd"
_ "github.com/go-chat-bot/plugins/crypto"
_ "github.com/go-chat-bot/plugins/encoding"
_ "github.com/go-chat-bot/plugins/example"
_ "github.com/go-chat-bot/plugins/gif"
_ "github.com/go-chat-bot/plugins/godoc"
_ "github.com/go-chat-bot/plugins/guid"
_ "github.com/go-chat-bot/plugins/jira"
_ "github.com/go-chat-bot/plugins/puppet"
_ "github.com/go-chat-bot/plugins/treta"
_ "github.com/go-chat-bot/plugins/uptime"
_ "github.com/go-chat-bot/plugins/url"
_ "github.com/go-chat-bot/plugins/web"
)
func responseHandler(target string, message string, sender *bot.User) {
if message == "" {
return
}
fmt.Println(fmt.Sprintf("%s: %s", sender.Nick, message))
}
func main() {
b := bot.New(&bot.Handlers{
Response: responseHandler,
},
&bot.Config{
Protocol: "debug",
Server: "debug",
},
)
fmt.Println("Type a command or !help for available commands...")
for {
r := bufio.NewReader(os.Stdin)
input, err := r.ReadString('\n')
if err != nil {
fmt.Println(err)
os.Exit(1)
}
b.MessageReceived(
&bot.ChannelData{
Protocol: "debug",
Server: "",
Channel: "console",
IsPrivate: true,
},
&bot.Message{Text: input},
&bot.User{ID: "id", RealName: "Debug Console", Nick: "bot", IsBot: false})
}
}