diff --git a/commands.go b/commands.go index 8cead2d..f785aa0 100644 --- a/commands.go +++ b/commands.go @@ -5,6 +5,7 @@ import ( "math/rand" "os" "path/filepath" + "sort" "strconv" "strings" "time" @@ -121,7 +122,34 @@ func Reboot(b BotCommand) bool { } func ActivityReport(b BotCommand) bool { - + statistics := "```" + n := map[int][]string{} + counter := 0 + var a []int + for k, v := range config.Activity { + n[v] = append(n[v], k) + } + for k := range n { + a = append(a, k) + } + sort.Sort(sort.Reverse(sort.IntSlice(a))) + for _, k := range a { + for _, s := range n[k] { + if counter == 4 { + return true + } + user, err := b.Session.GuildMember(config.GuildID, s) + if err == nil { + statistics += fmt.Sprintf("\n%+v: %+v", user.User.Username, k) + counter++ + } else { + log.LogErrorType(err) + } + } + } + + statistics += "\n```" + return true } func BumpSet(b BotCommand) bool {