style(files): reorganize everything
This commit is contained in:
parent
0a445aa1c7
commit
c408afc879
13 changed files with 422 additions and 389 deletions
|
@ -4,12 +4,13 @@ import (
|
|||
"fmt"
|
||||
"github.com/anhgelus/gokord"
|
||||
"github.com/anhgelus/gokord/utils"
|
||||
"github.com/anhgelus/les-copaings-bot/xp"
|
||||
"github.com/anhgelus/les-copaings-bot/exp"
|
||||
"github.com/anhgelus/les-copaings-bot/user"
|
||||
"github.com/bwmarrin/discordgo"
|
||||
)
|
||||
|
||||
func Top(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||
xp.LastEventUpdate(s, xp.GetCopaing(i.Member.User.ID, i.GuildID))
|
||||
user.LastEventUpdate(s, user.GetCopaing(i.Member.User.ID, i.GuildID))
|
||||
resp := utils.ResponseBuilder{C: s, I: i}
|
||||
err := resp.IsDeferred().Send()
|
||||
if err != nil {
|
||||
|
@ -18,14 +19,14 @@ func Top(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
|||
}
|
||||
resp.NotDeferred().IsEdit()
|
||||
go func() {
|
||||
var tops []xp.Copaing
|
||||
gokord.DB.Where("guild_id = ?", i.GuildID).Limit(10).Order("xp desc").Find(&tops)
|
||||
var tops []user.Copaing
|
||||
gokord.DB.Where("guild_id = ?", i.GuildID).Limit(10).Order("exp desc").Find(&tops)
|
||||
msg := ""
|
||||
for i, c := range tops {
|
||||
if i == 9 {
|
||||
msg += fmt.Sprintf("%d. **<@%s>** - niveau %d", i+1, c.DiscordID, xp.Level(c.XP))
|
||||
msg += fmt.Sprintf("%d. **<@%s>** - niveau %d", i+1, c.DiscordID, exp.Level(c.XP))
|
||||
} else {
|
||||
msg += fmt.Sprintf("%d. **<@%s>** - niveau %d\n", i+1, c.DiscordID, xp.Level(c.XP))
|
||||
msg += fmt.Sprintf("%d. **<@%s>** - niveau %d\n", i+1, c.DiscordID, exp.Level(c.XP))
|
||||
}
|
||||
}
|
||||
err = resp.Embeds([]*discordgo.MessageEmbed{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue