@@ -30,7 +30,7 @@ YAGPDB has a built-in random response system for custom commands, but sometimes
30
30
certain responses to occur. You can do this by creating a singular response and creating a variable with randInt. Then
31
31
use an if else if statement like this to print out your desired output.  ;
32
32
33
- ``` go
33
+ ``` yag
34
34
{{$var := randInt 100}}
35
35
36
36
{{if lt $var 10}}
@@ -52,7 +52,7 @@ following:
52
52
53
53
Trigger type: ` Join message in server channel `
54
54
55
- ``` go
55
+ ``` yag
56
56
{{if .UsernameHasInvite}}
57
57
{{$silent := execAdmin "ban" .User.ID "ad blocked"}}
58
58
{{else}}
@@ -69,7 +69,7 @@ This particular command loops over a cslice and a sdict.
69
69
70
70
Trigger type: ` Command ` Trigger: ` range `
71
71
72
- ``` go
72
+ ``` yag
73
73
{{/* range can iterate over many things, let's start with slice */}}
74
74
{{ $slice := cslice "YAGPDB " "is " "cool!" }}
75
75
{{/* Here, we range over with 1 argument, meaning the dot will be set to current iteration value */}}
@@ -89,7 +89,7 @@ your input that you are on. 
89
89
Range will work on any kind of slice/array. for example. If we wanted to look for all the entries in our database we can
90
90
use range and index through them all in the following.  ;
91
91
92
- ``` go
92
+ ``` yag
93
93
{{$lb := dbTopEntries "%" 100 0}}
94
94
{{range $lb}}
95
95
{{.UserID}} **:** {{.Key}} **:** {{.Value}}
@@ -106,7 +106,7 @@ will have to use `dict`.
106
106
107
107
Trigger type: ` Command ` Trigger: ` dict `
108
108
109
- ``` go
109
+ ``` yag
110
110
{{ $dict := dict 0 "foobar" "hello" "world" }}
111
111
{{/* Retrieve value with integer key with index */}}
112
112
0 - {{ index $dict 0 -}}
131
131
132
132
Trigger type: ` Command ` Trigger: ` send `   ;
133
133
134
- ``` go
134
+ ``` yag
135
135
{{$args := parseArgs 2 "Syntax is <channel> <text>"
136
136
(carg "channel" "channel to send to")
137
137
(carg "string" "text to send")}}
@@ -145,7 +145,7 @@ This example consists of two custom commands, and after copy/paste `REPLACE-WITH
145
145
actual custom command ID's in your system. This custom command is very complex, uses very many advanced functions, all
146
146
it does, constructs a 10 second countdown timer command-system for given starting time.
147
147
148
- ``` go
148
+ ``` yag
149
149
{{$args := parseArgs 2 ""
150
150
(carg "duration" "countdown-duration")
151
151
(carg "string" "countdown-message")}}
@@ -159,7 +159,7 @@ Second part of the custom commands, here we see, how `data`-part of exeCC was ma
159
159
` sdict ` and now we are calling those keys with ` .ExecData ` - for example ` .ExecData.MessageID ` sets new variable the same
160
160
as stated in previous code.
161
161
162
- ``` go
162
+ ``` yag
163
163
{{$timeLeft := .ExecData.T.Sub currentTime}}
164
164
{{$cntDownMessageHeader := print "Countdown Timer: " .ExecData.Message}}
165
165
{{$formattedTimeLeft := humanizeDurationSeconds $timeLeft}}
@@ -190,7 +190,7 @@ inserted to database begins with "notes\_".
190
190
191
191
#### Save note
192
192
193
- ``` go
193
+ ``` yag
194
194
{{$args := parseArgs 2 ""
195
195
(carg "string" "key")
196
196
(carg "string" "value")}}
@@ -201,7 +201,7 @@ Saved `{{$args.Get 0}}` as `{{$args.Get 1}}`
201
201
202
202
#### Get note
203
203
204
- ``` go
204
+ ``` yag
205
205
{{$key := print "notes_" .StrippedMsg}}
206
206
{{$note := dbGet .User.ID $key}}
207
207
{{if $note}}
@@ -215,7 +215,7 @@ Note: `{{$strippedKey}}` Created {{humanizeTimeSinceDays $note.CreatedAt}} ago:
215
215
216
216
#### List user's notes
217
217
218
- ` ` ` go
218
+ ``` yag
219
219
{{$notes := dbGetPattern .User.ID "notes_%" 100 0}}
220
220
{{range $notes}}
221
221
{{- $strippedKey := slice .Key 6 (len .Key)}}
@@ -230,7 +230,7 @@ You don't have any notes :(
230
230
With YAGPDB's database system, you can now add cooldowns to you custom commands. You can either make them global
231
231
cooldowns or a per user cooldown.
232
232
233
- ```go
233
+ ``` yag
234
234
{{/* CONFIGURATION HERE CHANGE VALUES AS NEEDED */}}
235
235
236
236
{{/* 0 for per user, 1 for global */}}
@@ -271,7 +271,7 @@ Trigger type: `Regex` Trigger: `\A`
271
271
272
272
` BE SURE TO RESTRICT THE COMMAND TO A SINGLE CHANNEL `   ;
273
273
274
- ` ` ` go
274
+ ``` yag
275
275
{{/* If you are not doing (no twice msg in a row) or (role assignment for latest user) you can remove counter_user and by extension everything to do with $lastUser*/}}
276
276
277
277
{{/* First time running command, set up initial values*/}}
@@ -339,7 +339,7 @@ command take away roles from someone instead of giving them by simply using the
339
339
340
340
Trigger type: ` Command ` Trigger: ` giveRoleName `
341
341
342
- ` ` ` go
342
+ ``` yag
343
343
{{if eq (len .Args) 3}}
344
344
{{$allowedRoles := (cslice "Patron" "Quality Patron" "Paypal Donors")}}
345
345
{{$role := (index .CmdArgs 1)}}
@@ -365,7 +365,7 @@ only string keys), `sendMessage`, and `cembed`in action.
365
365
366
366
Trigger type: ` Command ` Trigger: ` bc `
367
367
368
- ` ` ` go
368
+ ``` yag
369
369
{{if eq (len .Args) 3}}
370
370
{{$channel := (index .CmdArgs 0)}}
371
371
{{$msg:= (joinStr " " (slice .CmdArgs 1))}}
@@ -398,7 +398,7 @@ custom commands. 
398
398
399
399
Trigger type: ` Command ` Trigger: ` avatar `
400
400
401
- ` ` ` go
401
+ ``` yag
402
402
{{$ln := (len .Args)}}
403
403
{{$sizes := (cslice "16" "32" "64" "128" "256" "512" "1024" "2048" "4096")}}
404
404
{{$err1 := "Wrong image size input format! Possible values: 16, 32, 64, 128, 256, 512, 1024, 2048, 4096."}}
@@ -456,7 +456,7 @@ This command is used to replace suggestion bots. You can adapt it to your needs.
456
456
457
457
Trigger type: ` Command ` Trigger: ` suggest `
458
458
459
- ` ` ` go
459
+ ``` yag
460
460
{{ $channel := 476178740133494784 }} {{/* Replace this with your suggestion channel ID */}}
461
461
462
462
{{if gt (len .Args) 1}}
@@ -487,7 +487,7 @@ emote file directly from Discord's database.
487
487
488
488
Trigger type: ` Command ` Trigger: ` bigemote `
489
489
490
- ```go
490
+ ``` yag
491
491
{{ $matches := reFindAllSubmatches `<(a)?:.*?:(\d+)>` .StrippedMsg }}
492
492
{{ if $matches }}
493
493
{{ $animated := index $matches 0 1 }}
0 commit comments