mirror of
https://github.com/lyx0/nourybot.git
synced 2024-11-13 19:49:55 +01:00
add coinflip command
This commit is contained in:
parent
e6aa16feea
commit
8e158f35c2
16
pkg/commands/coinflip.go
Normal file
16
pkg/commands/coinflip.go
Normal 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")
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue