diff --git a/bot/bot.go b/bot/bot.go index 55fd0e2..d53648e 100644 --- a/bot/bot.go +++ b/bot/bot.go @@ -9,20 +9,21 @@ import ( type Bot struct { twitchClient *twitch.Client cfg *cfg.Config - log *log.Logger } -func NewBot(cfg *cfg.Config, log *log.Logger) *Bot { +func NewBot(cfg *cfg.Config) *Bot { + log.Info("fn Newbot") twitchClient := twitch.NewClient(cfg.Username, cfg.Oauth) + return &Bot{ cfg: cfg, twitchClient: twitchClient, - log: log, } } func (b *Bot) Connect() error { + log.Info("fn Connect") err := b.twitchClient.Connect() if err != nil { log.Error("Error Connecting from Twitch: ", err) @@ -47,3 +48,8 @@ func (b *Bot) Say(channel string, message string) { func (b *Bot) OnPrivateMessage(callback func(message *twitch.PrivateMessage)) { log.Info(callback) } + +func (b *Bot) Join(channel string) { + log.Info("fn Join") + b.twitchClient.Join(channel) +} diff --git a/cmd/main.go b/cmd/main.go index da29a2c..b8856ef 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -1,4 +1,15 @@ package main +import ( + "github.com/lyx0/nourybot/bot" + "github.com/lyx0/nourybot/config" +) + func main() { + cfg := config.LoadConfig() + nb := bot.NewBot(cfg) + + nb.Join("nourybot") + nb.Say("nourybot", "test") + nb.Connect() }