-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlb-shundo.yag
66 lines (56 loc) · 2.42 KB
/
lb-shundo.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{{/*
Shiny/Hundo/Shundo Host Leaderboard
Trigger: lb-shundo
Trigger Type: Command (mention/cmd prefix)
Require Roles: any/all roles who can display leaderboard
Restrict to specific channel(s) if desired
Generates shundo leaderboard
!lb-shundo <list length-number, optional>
1st argument (optional): list length (number)
if no argument is provided, default length used (defined below)
*/}}
{{/* Sets default list length—change to what you want the default to be */}}
{{$listNumber := 10}} {{/* Sets default list length to 10 */}}
{{/* Set up emojis for stats message */}}
{{ $shundoEmoji := "<a:anHostShundo:896949404194467850>" }}
{{/* Set up message fields */}}
{{ $lbTitle := "Shundo Host Leaderboard" }}
{{ $lbDescription := "These are the top hosts giving out shundos." }}
{{ $textFooter := "Statistics since September 1, 2021" }}
{{ $iconFooter := "https://cdn.discordapp.com/emojis/734611758207074406.png" }}
{{/* ------------ DO NOT ALTER CODE BELOW ------------ */}}
{{/* Parsing and checking command arguments */}}
{{$args := parseArgs 0 "Optional List Length" (carg "int" "list length")}}
{{ if $args.IsSet 0 }}
{{$listNumber = ($args.Get 0) }}
{{ end }}
{{/* Setting up Shiny Leaderboard List */}}
{{$data := dbTopEntries "shundo" $listNumber 0}}
{{$listShundo := ""}}{{$c := 0}}
{{range $data}}{{$c = add $c 1}}{{$h := toInt (.Value)}}
{{ if gt $h 0}}
{{ if .User.Username }}
{{ if eq $c 1}}
{{- $listShundo = print $listShundo "🥇 " (or (getMember .User.ID).Nick .User.Username) "—" .Value "\n" -}}
{{ else if eq $c 2}}
{{- $listShundo = print $listShundo "🥈 " (or (getMember .User.ID).Nick .User.Username) "—" .Value "\n" -}}
{{ else if eq $c 3}}
{{- $listShundo = print $listShundo "🥉 " (or (getMember .User.ID).Nick .User.Username) "—" .Value "\n" -}}
{{ else }}
{{- $listShundo = print $listShundo "🏅 " (or (getMember .User.ID).Nick .User.Username) "—" .Value "\n" -}}
{{ end }}
{{ end }}
{{ end }}
{{end}}
{{/* Printing Out Leaderboard Lists */}}
{{/* Shundo Leaderboard */}}
{{$embed := cembed
"title" $lbTitle
"description" $lbDescription
"color" 4645612
"footer" (sdict "text" $textFooter "icon_url" $iconFooter)
"fields" (cslice
(sdict "name" (println "Shundo Hosts " $shundoEmoji ) "value" $listShundo "inline" false)
)
}}
{{ sendMessage nil $embed }}