-
Notifications
You must be signed in to change notification settings - Fork 66
/
reaction.yag
52 lines (50 loc) · 1.55 KB
/
reaction.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
{{/*
Trigger type: Reaction (add)
Copyright (c): Black Wolf, 2021
License: MIT
Repository: https://github.com/BlackWolfWoof/yagpdb-cc/
*/}}
{{/*When using poll as trigger make sure to disable the default poll command here --> https://i.imgur.com/8WlHqyo.gif*/}}
{{$single := 0}}{{$c := 0}}{{$c1 := 0}}
{{with .Message.Embeds}}{{with (index . 0).Author}}{{with .IconURL}}{{if in . `?single=true`}}{{$single = 2}}{{else if in . `?single=false`}}{{$single = 1}}{{end}}{{end}}{{end}}{{end}}
{{if eq $single 2}}
{{if .ExecData}}
{{$r := .ExecData}}
{{range .Message.Reactions}}
{{- if ne $c 10}}
{{- if not .Me}}
{{- deleteAllMessageReactions nil $.Message.ID .Emoji.APIName}}
{{- $c = add 1 $c}}
{{- else}}
{{- if ne $r.Emoji.Name .Emoji.Name}}
{{- deleteMessageReaction nil $.Message.ID $.User.ID .Emoji.APIName}}
{{- $c = add 1 $c}}
{{- end}}
{{- end}}
{{- end}}
{{- if ne $c1 10}}
{{- cancelScheduledUniqueCC $.CCID (print "poll" $.User.ID)}}
{{- $c1 = add $c1 1}}
{{- end}}
{{end}}
{{else}}
{{range .Message.Reactions}}
{{- if lt $c 2}}
{{- if not .Me}}
{{- deleteAllMessageReactions nil $.Message.ID .Emoji.APIName}}
{{- $c = add 1 $c}}
{{- end}}
{{- end}}
{{- end}}
{{scheduleUniqueCC .CCID nil 10 (print "poll" .User.ID) .Reaction}}
{{end}}
{{else if eq $single 1}}
{{range .Message.Reactions}}
{{- if le $c 10}}
{{- if not .Me}}
{{- deleteAllMessageReactions nil $.Message.ID .Emoji.APIName}}
{{- $c = add 1 $c}}
{{- end}}
{{- end}}
{{- end}}
{{end}}