mirror of
https://github.com/lyx0/nourybot.git
synced 2024-11-13 19:49:55 +01:00
Connect Disconnect
This commit is contained in:
parent
3da33468fe
commit
66eeeee7dc
28
bot/bot.go
28
bot/bot.go
|
@ -12,11 +12,6 @@ type Bot struct {
|
|||
log *log.Logger
|
||||
}
|
||||
|
||||
func (b *Bot) newTwitchClient() *twitch.Client {
|
||||
twitchClient := twitch.NewClient(b.cfg.Username, b.cfg.Oauth)
|
||||
return twitchClient
|
||||
}
|
||||
|
||||
func NewBot(cfg *cfg.Config, log *log.Logger, twitchClient *twitch.Client) *Bot {
|
||||
return &Bot{
|
||||
cfg: cfg,
|
||||
|
@ -24,3 +19,26 @@ func NewBot(cfg *cfg.Config, log *log.Logger, twitchClient *twitch.Client) *Bot
|
|||
log: log,
|
||||
}
|
||||
}
|
||||
|
||||
func (b *Bot) newTwitchClient() *twitch.Client {
|
||||
twitchClient := twitch.NewClient(b.cfg.Username, b.cfg.Oauth)
|
||||
return twitchClient
|
||||
}
|
||||
|
||||
func (b *Bot) Connect() error {
|
||||
err := b.twitchClient.Connect()
|
||||
if err != nil {
|
||||
log.Error("Error Connecting from Twitch: ", err)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (b *Bot) Disconnect() error {
|
||||
err := b.twitchClient.Disconnect()
|
||||
if err != nil {
|
||||
log.Error("Error Disconnecting from Twitch: ", err)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue