forked from Clinet/clinet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmd-random.go
29 lines (26 loc) · 909 Bytes
/
cmd-random.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package main
import (
"math/rand"
"strconv"
"github.com/bwmarrin/discordgo"
)
func commandRoll(args []string, env *CommandEnvironment) *discordgo.MessageEmbed {
random := rand.Intn(6) + 1
return NewGenericEmbed("Roll", "You rolled a "+strconv.Itoa(random)+"!")
}
func commandDoubleRoll(args []string, env *CommandEnvironment) *discordgo.MessageEmbed {
random1 := rand.Intn(6) + 1
random2 := rand.Intn(6) + 1
randomTotal := random1 + random2
return NewGenericEmbed("Double Roll", "You rolled a "+strconv.Itoa(random1)+" and a "+strconv.Itoa(random2)+". The total is "+strconv.Itoa(randomTotal)+"!")
}
func commandCoinFlip(args []string, env *CommandEnvironment) *discordgo.MessageEmbed {
random := rand.Intn(2)
switch random {
case 0:
return NewGenericEmbed("Coin Flip", "The coin landed on heads!")
case 1:
return NewGenericEmbed("Coin Flip", "The coin landed on tails!")
}
return nil
}