Add user activity
This commit is contained in:
30
commands.go
30
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 {
|
||||
|
||||
Reference in New Issue
Block a user