add coinflip command

This commit is contained in:
lyx0 2021-10-14 22:05:12 +02:00
parent e6aa16feea
commit 8e158f35c2
2 changed files with 27 additions and 0 deletions

16
pkg/commands/coinflip.go Normal file
View file

@ -0,0 +1,16 @@
package commands
import (
"github.com/gempir/go-twitch-irc/v2"
"github.com/lyx0/nourybot/pkg/utils"
)
func Coinflip(channel string, client *twitch.Client) {
result := utils.GenerateRandomNumber(2)
if result == 1 {
client.Say(channel, "Heads")
} else {
client.Say(channel, "Tails")
}
}

View file

@ -48,5 +48,16 @@ func HandleCommand(message twitch.PrivateMessage, twitchClient *twitch.Client, u
return
case "ping":
commands.Ping(message.Channel, twitchClient, uptime)
return
case "cf":
commands.Coinflip(message.Channel, twitchClient)
return
case "coin":
commands.Coinflip(message.Channel, twitchClient)
return
case "coinflip":
commands.Coinflip(message.Channel, twitchClient)
return
}
}