mirror of
https://github.com/lyx0/nourybot.git
synced 2024-11-13 19:49:55 +01:00
idk
This commit is contained in:
parent
325b244f92
commit
64b449252f
12
bot/bot.go
12
bot/bot.go
|
@ -12,7 +12,9 @@ type Bot struct {
|
|||
log *log.Logger
|
||||
}
|
||||
|
||||
func NewBot(cfg *cfg.Config, log *log.Logger, twitchClient *twitch.Client) *Bot {
|
||||
func NewBot(cfg *cfg.Config, log *log.Logger) *Bot {
|
||||
|
||||
twitchClient := twitch.NewClient(cfg.Username, cfg.Oauth)
|
||||
return &Bot{
|
||||
cfg: cfg,
|
||||
twitchClient: twitchClient,
|
||||
|
@ -20,11 +22,6 @@ func NewBot(cfg *cfg.Config, log *log.Logger, twitchClient *twitch.Client) *Bot
|
|||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
|
@ -44,8 +41,7 @@ func (b *Bot) Disconnect() error {
|
|||
}
|
||||
|
||||
func (b *Bot) Say(channel string, message string) {
|
||||
tc := b.newTwitchClient()
|
||||
tc.Say(channel, message)
|
||||
b.twitchClient.Say(channel, message)
|
||||
}
|
||||
|
||||
func (b *Bot) OnPrivateMessage(callback func(message *twitch.PrivateMessage)) {
|
||||
|
|
4
cmd/main.go
Normal file
4
cmd/main.go
Normal file
|
@ -0,0 +1,4 @@
|
|||
package main
|
||||
|
||||
func main() {
|
||||
}
|
Loading…
Reference in a new issue