|
|
|
@ -37,7 +37,8 @@ type Config struct {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var ( |
|
|
|
|
config = Config{} |
|
|
|
|
config = Config{} |
|
|
|
|
rrCylinder int |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
func main() { |
|
|
|
@ -52,6 +53,9 @@ func main() {
|
|
|
|
|
lines := strings.Split(string(credentials), "\n") |
|
|
|
|
auth := lines[0] |
|
|
|
|
|
|
|
|
|
// seed the rr cylinder
|
|
|
|
|
rrCylinder = rand.Intn(6-1) + 1 |
|
|
|
|
|
|
|
|
|
// Create a new Discord session using the provided bot token.
|
|
|
|
|
goBot, err := discordgo.New("Bot " + auth) |
|
|
|
|
if err != nil { |
|
|
|
@ -373,11 +377,18 @@ func rollHandler(s *discordgo.Session, m *discordgo.MessageCreate) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func rrHandler(s *discordgo.Session, m *discordgo.MessageCreate) { |
|
|
|
|
dice := []string{"*click*", "*BANG*", "*click*", "*click*", "*click*", "*click*"} |
|
|
|
|
rand.Seed(time.Now().UnixNano()) |
|
|
|
|
rndStr := dice[rand.Intn(len(dice)-1)] |
|
|
|
|
|
|
|
|
|
s.ChannelMessageSend(m.ChannelID, rndStr) |
|
|
|
|
// decriment counter
|
|
|
|
|
rrCylinder = rrCylinder - 1 |
|
|
|
|
|
|
|
|
|
// check if we are at 0
|
|
|
|
|
if rrCylinder == 0 { |
|
|
|
|
// you've been hit by, you've been struck by a smooth bore
|
|
|
|
|
s.ChannelMessageSend(m.ChannelID, "*BANG*") |
|
|
|
|
s.ChannelMessageSend(m.ChannelID, "https://i.imgur.com/9jWcCyt.gifv") |
|
|
|
|
rrCylinder = rand.Intn(6-1) + 1 |
|
|
|
|
} else { |
|
|
|
|
s.ChannelMessageSend(m.ChannelID, "*click*") |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func diceRollHandler(s *discordgo.Session, m *discordgo.MessageCreate) { |
|
|
|
|