Compare commits

...

7 Commits

Author SHA1 Message Date
skeletable e079438254 no negative candy for indebted users 2022-10-02 17:18:33 +02:00
skeletable f471ee2734 unlock multipliers 2022-10-02 16:11:43 +02:00
skeletable 2d8b850bc6 candy 2022-10-02 15:06:48 +02:00
skeletable 918a7c0f41 debug 2022-10-02 15:02:26 +02:00
skeletable 203bc227f3 custom candy spawner 2022-10-02 14:59:21 +02:00
skeletable 6ba5e66fcf custom candy spawner 2022-10-02 14:56:20 +02:00
skeletable d3dd80cf0f custom candy spawner 2022-10-02 14:49:32 +02:00
1 changed files with 55 additions and 29 deletions

84
main.go
View File

@ -123,7 +123,7 @@ func getCandyPic() string {
return pics[rand.Intn(len(pics))]
}
func candy(s *discordgo.Session, channel string) {
func candy(s *discordgo.Session, channel string, droptype string) {
candy1 := &discordgo.MessageEmbed{
Title: "Candy",
Color: 0,
@ -216,29 +216,50 @@ func candy(s *discordgo.Session, channel string) {
}
drop := candy1
rand.Seed(time.Now().Unix())
switch rand.Intn(40) {
case 1, 2:
drop = candyCaptain
case 3, 4:
drop = candyMilky
case 5, 6:
drop = candyRadmeal
case 7:
drop = candyMeta
case 8, 9:
drop = candyXorcon
case 10, 11:
drop = candyKornflake
case 12, 13:
drop = candyKiko
case 39:
drop = candyChaos
default:
drop = candy1
if droptype == "" {
rand.Seed(time.Now().Unix())
switch rand.Intn(40) {
case 1, 2:
drop = candyCaptain
case 3, 4:
drop = candyMilky
case 5, 6:
drop = candyRadmeal
case 7:
drop = candyMeta
case 8, 9:
drop = candyXorcon
case 10, 11:
drop = candyKornflake
case 12, 13:
drop = candyKiko
case 39:
drop = candyChaos
default:
drop = candy1
}
} else {
switch droptype {
case "candyCaptain":
drop = candyCaptain
case "candyMilky":
drop = candyMilky
case "candyRadmeal":
drop = candyRadmeal
case "candyMeta":
drop = candyMeta
case "candyXorcon":
drop = candyXorcon
case "candyKornflake":
drop = candyKornflake
case "candyKiko":
drop = candyKiko
case "candyChaos":
drop = candyChaos
default:
drop = candy1
}
}
ms := &discordgo.MessageSend{
Content: "🍬 ***Some candy has appeared! React to this message to claim it.*** 🍬",
Embed: drop,
@ -725,12 +746,12 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
multiplier = maxcandy / usercandy
}
}
if multiplier > 10 {
multiplier = 10
}
candyvalue *= multiplier
candystr = "+" + fmt.Sprint(candyvalue)
} else if m.Embeds[0].Footer.Text != "candyChaos" {
if usercandy < 0 {
candyvalue = int(math.Abs(float64(candyvalue)))
}
candystr = fmt.Sprint(candyvalue)
} else {
multiplier = rand.Intn(21) - 10
@ -765,7 +786,7 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
rand.Seed(time.Now().Unix())
if rand.Intn(100) < 4 {
candy(s, m.ChannelID)
candy(s, m.ChannelID, "")
}
if strings.HasPrefix(m.Content, "pp!") {
@ -1284,8 +1305,13 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
s.ChannelMessageSend(m.ChannelID, "Unblocked "+felon)
}
if m.Content == "insert candy" && m.Author.ID == "228911057316347905" {
candy(s, m.ChannelID)
if strings.HasPrefix(m.Content, "pp!spawncandy") && m.Author.ID == "228911057316347905" {
arg := strings.Split(m.Content, " ")
if len(arg) < 2 {
candy(s, m.ChannelID, "")
} else {
candy(s, m.ChannelID, arg[1])
}
}
if strings.HasPrefix(m.Content, "pp!db") && m.Author.ID == "228911057316347905" {