fix(lint): fixing more complex formatters problems.

This commit is contained in:
Houmgaor
2025-10-19 22:46:21 +02:00
parent 1398383a8d
commit fc6e479df9
9 changed files with 20 additions and 105 deletions

View File

@@ -4,69 +4,10 @@ import (
"fmt"
"github.com/bwmarrin/discordgo"
"golang.org/x/crypto/bcrypt"
"sort"
"strings"
"unicode"
)
type Player struct {
CharName string
QuestID int
}
func getPlayerSlice(s *Server) []Player {
var p []Player
var questIndex int
for _, channel := range s.Channels {
for _, stage := range channel.stages {
if len(stage.clients) == 0 {
continue
}
questID := 0
if stage.isQuest() {
questIndex++
questID = questIndex
}
for client := range stage.clients {
p = append(p, Player{
CharName: client.Name,
QuestID: questID,
})
}
}
}
return p
}
func getCharacterList(s *Server) string {
questEmojis := []string{
":person_in_lotus_position:",
":white_circle:",
":red_circle:",
":blue_circle:",
":brown_circle:",
":green_circle:",
":purple_circle:",
":yellow_circle:",
":orange_circle:",
":black_circle:",
}
playerSlice := getPlayerSlice(s)
sort.SliceStable(playerSlice, func(i, j int) bool {
return playerSlice[i].QuestID < playerSlice[j].QuestID
})
message := fmt.Sprintf("===== Online: %d =====\n", len(playerSlice))
for _, player := range playerSlice {
message += fmt.Sprintf("%s %s", questEmojis[player.QuestID], player.CharName)
}
return message
}
// onInteraction handles slash commands
func (s *Server) onInteraction(ds *discordgo.Session, i *discordgo.InteractionCreate) {
switch i.Interaction.ApplicationCommandData().Name {