-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
48 lines (39 loc) · 910 Bytes
/
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
package main
import (
"flag"
"fmt"
"io/ioutil"
"os"
"strings"
"github.com/chelexa/trofiebot/bot"
)
func main() {
//Parse command line arguments
flag.Parse()
command := flag.Arg(0)
//TODO: Other functionality, i.e "help", etc.
switch command {
case "run":
runBot()
default:
fmt.Println("Thanks for running emotemon! Please user the `run` flag to enable the chat interaction mode.")
}
}
func runBot() {
ircbot := bot.NewBot()
go ircbot.ConsoleInput()
ircbot.Connect()
defer ircbot.Close()
//authenticating w/ twitch auth token
pass1, err := ioutil.ReadFile("twitch_pass.txt")
if err != nil {
fmt.Println("Error reading from twitch_pass.txt. Maybe it isn't created?")
os.Exit(1)
}
pass := strings.Replace(string(pass1), "\n", "", 0)
fmt.Printf("The password used is: %s\r\n", string(pass))
ircbot.LogIn(pass)
go ircbot.AutoMessage()
//run forever :)
ircbot.Start()
}