reworked coinflip command
This commit is contained in:
@@ -5,6 +5,7 @@ This contains all of our commands used throughout the bot except for image gathe
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"math"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
@@ -12,10 +13,10 @@ import (
|
|||||||
// flip a coin
|
// flip a coin
|
||||||
func coinflip(author string) string{
|
func coinflip(author string) string{
|
||||||
// get a random 1 or 0
|
// get a random 1 or 0
|
||||||
num := rand.Intn(1)
|
num := math.Mod(float64(rand.Intn(100)), 2) // modulo of random number between 0 and 100
|
||||||
|
|
||||||
// return string based on number
|
// return string based on number
|
||||||
if num == 0 { // heads
|
if int(num) == 0 { // heads
|
||||||
return "<@" + author + "> flipped a coin, it landed on **heads!**"
|
return "<@" + author + "> flipped a coin, it landed on **heads!**"
|
||||||
} else { // tails
|
} else { // tails
|
||||||
return "<@" + author + "> flipped a coin, it landed on **tails!**"
|
return "<@" + author + "> flipped a coin, it landed on **tails!**"
|
||||||
|
Reference in New Issue
Block a user