|
|
|
@ -2,8 +2,6 @@ package commands
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"math/rand"
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"github.com/bwmarrin/discordgo"
|
|
|
|
|
|
|
|
|
@ -29,25 +27,13 @@ func handleRecalculateLevel(dg *discordgo.Session, m *discordgo.MessageCreate, a
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
util.SendSuccessEmbed(dg, m.ChannelID, "Level is being recalculated.")
|
|
|
|
|
rand.Seed(time.Now().UnixNano())
|
|
|
|
|
calculationCode = randomBase64(20)
|
|
|
|
|
calculationCode = util.RandomBase64(20)
|
|
|
|
|
level.RecalculateEverything(dg, m.GuildID)
|
|
|
|
|
util.SendSuccessEmbed(dg, m.ChannelID, "Level recalculated successfully.")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+="
|
|
|
|
|
|
|
|
|
|
var calculationCode string
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
|
rand.Seed(time.Now().UnixNano())
|
|
|
|
|
calculationCode = randomBase64(20)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func randomBase64(n int) string {
|
|
|
|
|
b := make([]byte, n)
|
|
|
|
|
for i := range b {
|
|
|
|
|
b[i] = letterBytes[rand.Int63()%int64(len(letterBytes))]
|
|
|
|
|
}
|
|
|
|
|
return string(b)
|
|
|
|
|
calculationCode = util.RandomBase64(20)
|
|
|
|
|
}
|
|
|
|
|