From 61f8f500304cb5bfd8b1e26282ad75faf903c83e Mon Sep 17 00:00:00 2001 From: Daniel Tam Date: Wed, 10 Jun 2020 00:40:52 -0500 Subject: [PATCH] added coin flip --- commands.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 commands.go diff --git a/commands.go b/commands.go new file mode 100644 index 0000000..e9108dd --- /dev/null +++ b/commands.go @@ -0,0 +1,22 @@ +/* +This contains all of our commands used throughout the bot except for image gathering +*/ + +package main + +import ( + "math/rand" +) + +// flip a coin +func coinflip(author string) string{ + // get a random 1 or 0 + num := rand.Intn(1) + + // return string based on number + if num == 0 { // heads + return "<@" + author + "> flipped a coin, it landed on **heads!**" + } else { // tails + return "<@" + author + "> flipped a coin, it landed on **tails!**" + } +} \ No newline at end of file