forked from BlackWolfWoof/yagpdb-cc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
topcount.yag
41 lines (32 loc) · 1.27 KB
/
topcount.yag
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{{/*
Trigger: topcount
Trigger Type: Command
Usage:
-topcount <page>
Copyright (c): Satty#9361 (creator) & @blackwolfwoof (modified), 2021
License: MIT
Repository: https://github.com/BlackWolfWoof/yagpdb-cc/
*/}}
{{$page := 1}}{{$id := 0}}
{{if .CmdArgs}}
{{$page = toInt (index .CmdArgs 0)}}
{{if lt $page 1}}
{{$page = 1}}
{{end}}
{{end}}
{{$num_per_page := 10}}
{{$skip := mult (sub $page 1) $num_per_page}}
{{$text := ""}}{{$count := add $skip 1}}
{{range (dbTopEntries `counting_tracker` 10 $skip)}}
{{$member := getMember .UserID}}
{{if $member}}
{{$text = joinStr "\n" $text (printf "#%-4d %5d - %-20s" $count (toInt .Value) $member.User)}}
{{else}}
{{$text = joinStr "\n" $text (printf "#%-4d %5d - %-20d" $count (toInt .Value) .UserID)}}
{{end}}
{{$count = add $count 1}}
{{end}}
{{if $text}}
{{$embed := cembed "author" (sdict "name" "Counting Leaderboard" "icon_url" (print "https://cdn.discordapp.com/emojis/714491414100181092.png?author=" .User.ID "?messageid=" .Message.ID)) "description" (print "```# -- Points -- User\n" $text "```") "footer" (sdict "text" (print "React with 🗑️ to delete this message.\nPage: " $page)) "color" (randInt 0 16777216)}}
{{addMessageReactions nil (sendMessageRetID nil $embed) "⬅️" "➡️" "🗑️"}}
{{end}}