diff --git a/pkg/commands/coinflip.go b/pkg/commands/coinflip.go new file mode 100644 index 0000000..c713041 --- /dev/null +++ b/pkg/commands/coinflip.go @@ -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") + } +} diff --git a/pkg/handlers/command.go b/pkg/handlers/command.go index 88925d2..9eebb8f 100644 --- a/pkg/handlers/command.go +++ b/pkg/handlers/command.go @@ -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 + } }