Connect Disconnect

This commit is contained in:
lyx0 2021-10-13 21:39:34 +02:00
parent 3da33468fe
commit 66eeeee7dc

View file

@ -12,11 +12,6 @@ type Bot struct {
log *log.Logger 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 { func NewBot(cfg *cfg.Config, log *log.Logger, twitchClient *twitch.Client) *Bot {
return &Bot{ return &Bot{
cfg: cfg, cfg: cfg,
@ -24,3 +19,26 @@ func NewBot(cfg *cfg.Config, log *log.Logger, twitchClient *twitch.Client) *Bot
log: log, 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
}