|
|
@ -2,8 +2,6 @@ package commands
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
"math/rand"
|
|
|
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/bwmarrin/discordgo"
|
|
|
|
"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.")
|
|
|
|
util.SendSuccessEmbed(dg, m.ChannelID, "Level is being recalculated.")
|
|
|
|
rand.Seed(time.Now().UnixNano())
|
|
|
|
calculationCode = util.RandomBase64(20)
|
|
|
|
calculationCode = randomBase64(20)
|
|
|
|
|
|
|
|
level.RecalculateEverything(dg, m.GuildID)
|
|
|
|
level.RecalculateEverything(dg, m.GuildID)
|
|
|
|
util.SendSuccessEmbed(dg, m.ChannelID, "Level recalculated successfully.")
|
|
|
|
util.SendSuccessEmbed(dg, m.ChannelID, "Level recalculated successfully.")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var calculationCode string
|
|
|
|
var calculationCode string
|
|
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
func init() {
|
|
|
|
rand.Seed(time.Now().UnixNano())
|
|
|
|
calculationCode = util.RandomBase64(20)
|
|
|
|
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)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|