Browse Source

Add user activity

master
Gregory Rudolph 3 years ago
parent
commit
5222b1b3b6
Signed by: rudi
GPG Key ID: EF64F3CBD1A1EBDD
  1. 30
      commands.go

30
commands.go

@ -5,6 +5,7 @@ import ( @@ -5,6 +5,7 @@ import (
"math/rand"
"os"
"path/filepath"
"sort"
"strconv"
"strings"
"time"
@ -121,7 +122,34 @@ func Reboot(b BotCommand) bool { @@ -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 {

Loading…
Cancel
Save