feat: Report recalculate level status

master
Luther Wen Xu 2020-05-31 11:21:13 +07:00
parent 499ec2de8d
commit 2dc1c925ea
Signed by: chanbakjsd
GPG Key ID: B7D77E3E9D102B70
1 changed files with 5 additions and 1 deletions

@ -12,6 +12,9 @@ import (
) )
func handleRecalculateLevel(dg *discordgo.Session, m *discordgo.MessageCreate, arguments []string) { func handleRecalculateLevel(dg *discordgo.Session, m *discordgo.MessageCreate, arguments []string) {
if !level.ShouldListen {
util.SendFailEmbed(dg, m.ChannelID, "Recalculation In Progress", "❌ Recalculation is already in progress!")
}
if len(arguments) == 0 { if len(arguments) == 0 {
util.SendFailEmbed( util.SendFailEmbed(
dg, m.ChannelID, "Bot Owner Access Required", dg, m.ChannelID, "Bot Owner Access Required",
@ -26,9 +29,10 @@ func handleRecalculateLevel(dg *discordgo.Session, m *discordgo.MessageCreate, a
) )
} }
util.SendSuccessEmbed(dg, m.ChannelID, "Level is being recalculated.") util.SendSuccessEmbed(dg, m.ChannelID, "Level is being recalculated.")
level.RecalculateEverything(dg, m.GuildID)
rand.Seed(time.Now().UnixNano()) rand.Seed(time.Now().UnixNano())
calculationCode = randomBase64(20) calculationCode = randomBase64(20)
level.RecalculateEverything(dg, m.GuildID)
util.SendSuccessEmbed(dg, m.ChannelID, "Level recalculated successfully.")
} }
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+=" const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+="