forked from BlackWolfWoof/yagpdb-cc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
reactions.yag
165 lines (163 loc) Β· 6.3 KB
/
reactions.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
{{/*
Trigger Type: Reaction (add)
Copyright (c): Black Wolf, 2021
License: MIT
Repository: https://github.com/BlackWolfWoof/yagpdb-cc/
*/}}
{{$grab := ""}}
{{$call := dbGetPattern .User.ID "%message" 100 0}}
{{range $call}}
{{if eq .UserID .User.ID}}
{{$grab = print $grab " " .Value}}
{{end}}
{{end}}
{{/*Delete Embed*/}}
{{$t11 := `del(?:(?P<MessageIDEmbed>\d{18,})-(?P<MessageIDAuthor>\d{18,}))`}}
{{range $call}}
{{if and (eq $.Reaction.Emoji.Name "β") (reFind $t11 .Value)}}
{{$m := reFindAllSubmatches $t11 .Value}}
{{if (reFind (str $.Reaction.MessageID) (str .Value))}}
{{deleteMessage $.Reaction.ChannelID (index (index $m 0) 1) 0}}
{{deleteMessage $.Reaction.ChannelID (index (index $m 0) 2) 0}}
{{dbDelByID .UserID .ID}}
{{end}}
{{end}}
{{end}}
{{$e1 := `mod(?:(?P<MessageID>\d{18,})-(?P<ModUserID>\d{18,}))`}}
{{if and $call (reFind $e1 $grab)}} {{$matches := reFindAllSubmatches $e1 $grab}} {{$user := userArg (index (index $matches 0) 2)}}
{{$users := "Unknown User"}}
{{$usera := "https://cdn.discordapp.com/emojis/565142262401728512.png"}}
{{$userid := toInt (index (index $matches 0) 2)}}
{{if $user}}
{{$users = $user.String}}
{{$usera = $user.AvatarURL "1024"}}
{{end}}
{{/*Ban User*/}}
{{if eq .Reaction.Emoji.Name "bongoban"}}
{{range $call}}
{{$grab = (print $grab " " .Value)}}
{{end}}
{{if (reFind `mod(?:(?P<MessageID>\d+)-(?P<ModUserID>\d+))` $grab)}}
{{$matches := (reFindAllSubmatches `mod(?:(?P<MessageID>\d+)-(?P<ModUserID>\d+))` $grab)}}
{{if eq (str .Reaction.MessageID) (str (index (index $matches 0) 1))}}
{{editMessage nil .Reaction.MessageID (cembed
"author" (sdict
"name" (print $users " - Mod Panel")
"icon_url" $usera)
"description" "Option to ban <a:bongoban:636572687124398081> this user:\nπ - 1 Day\nπ - 1 Week\nπ - 2 Months\nπ - 4 Months\nπ - Permanent"
"color" 0x77FF68)}}
{{deleteAllMessageReactions nil .Reaction.MessageID}}
{{addMessageReactions nil .Reaction.MessageID "π" "π" "π" "π" "π" "β"}}
{{dbSetExpire .User.ID "modmenu" "ban" 300}}
{{end}}
{{end}}
{{end}}
{{/*Kick User*/}}
{{if eq .Reaction.Emoji.Name "π’"}}
{{range $call}}
{{if eq .UserID $.User.ID}}
{{$grab = (print $grab " " .Value)}}
{{end}}
{{end}}
{{if (reFind `mod(?:(?P<MessageID>\d+)-(?P<ModUserID>\d+))` $grab)}}
{{$matches := (reFindAllSubmatches `mod(?:(?P<MessageID>\d+)-(?P<ModUserID>\d+))` $grab)}}
{{if eq (str .Reaction.MessageID) (str (index (index $matches 0) 1))}}
{{deleteAllMessageReactions nil (str .Reaction.MessageID)}}
{{addMessageReactions nil (str .Reaction.MessageID) "β"}}
{{editMessage nil (str .Reaction.MessageID) (cembed
"author" (sdict
"name" (print $users " - Mod Panel")
"icon_url" $usera)
"description" (exec "kick" $userid "Kicked by Mod Panel")
"color" 0x77FF68)}}
{{end}}
{{end}}
{{end}}
{{/*Mute User*/}}
{{if eq .Reaction.Emoji.ID 711553322225500201}}
{{range $call}}
{{$grab = (print $grab " " .Value)}}
{{end}}
{{if (reFind `mod(?:(?P<MessageID>\d+)-(?P<ModUserID>\d+))` $grab)}}
{{$matches := (reFindAllSubmatches `mod(?:(?P<MessageID>\d+)-(?P<ModUserID>\d+))` $grab)}}
{{if eq (str .Reaction.MessageID) (str (index (index $matches 0) 1))}}
{{editMessage nil (str .Reaction.MessageID) (cembed
"author" (sdict
"name" (print $users " - Mod Panel")
"icon_url" $usera)
"description" "Option to mute <:servermute:711553322225500201> this user:\nπ - 5 Minutes\nπ - 10 Minutes\nπ - 20 Minutes\nπ - 1 Hour"
"color" 0x77FF68)}}
{{deleteAllMessageReactions nil (str .Reaction.MessageID)}}
{{addMessageReactions nil (str .Reaction.MessageID) "π" "π" "π" "π" "β"}}
{{dbSetExpire .User.ID "modmenu" "mute" 300}}
{{end}}
{{end}}
{{end}}
{{/*Unmute User*/}}
{{if eq .Reaction.Emoji.Name "π"}}
{{range $call}}
{{if eq .UserID .User.ID}}
{{$grab = (print $grab " " .Value)}}
{{end}}
{{end}}
{{if (reFind `mod(?:(?P<MessageID>\d+)-(?P<ModUserID>\d+))` $grab)}}
{{$matches := (reFindAllSubmatches `mod(?:(?P<MessageID>\d+)-(?P<ModUserID>\d+))` $grab)}}
{{if eq (str .Reaction.MessageID) (str (index (index $matches 0) 1))}}
{{deleteAllMessageReactions nil (str .Reaction.MessageID)}}
{{addMessageReactions nil (str .Reaction.MessageID) "β"}}
{{editMessage nil (str .Reaction.MessageID) (cembed
"author" (sdict
"name" (print $users " - Mod Panel")
"icon_url" $usera)
"description" (exec "unmute" $userid "Unmuted by Mod Panel")
"color" 0x77FF68)}}
{{end}}
{{end}}
{{end}}
{{/*Checking for time emojis*/}}
{{$result := 0}}{{$mute := "0"}}{{$ban := "0"}}
{{if eq .Reaction.Emoji.Name "π"}}
{{$result = 1}}{{$mute = "5m"}}{{$ban = "1d"}}
{{end}}
{{if eq .Reaction.Emoji.Name "π"}}
{{$result = 1}}{{$mute = "10m"}}{{$ban = "1w"}}
{{end}}
{{if eq .Reaction.Emoji.Name "π"}}
{{$result = 1}}{{$mute = "20m"}}{{$ban = "2mo"}}
{{end}}
{{if eq .Reaction.Emoji.Name "π"}}
{{$result = 1}}{{$mute = "1h"}}{{$ban = "4mo"}}
{{end}}
{{if eq .Reaction.Emoji.Name "π"}}
{{$result = 1}}{{$ban = ""}}
{{end}}
{{if eq $result 1}}
{{range $call}}
{{if eq .UserID .User.ID}}
{{$grab = (print $grab " " .Value)}}
{{end}}
{{end}}
{{if (reFind `mod(?:(?P<MessageID>\d+)-(?P<ModUserID>\d+))` $grab)}}
{{$matches := (reFindAllSubmatches `mod(?:(?P<MessageID>\d+)-(?P<ModUserID>\d+))` $grab)}}
{{$author := (sdict "name" (print $users " - Mod Panel") "icon_url" $usera)}}
{{if eq (str .Reaction.MessageID) (str (index (index $matches 0) 1))}}
{{if eq (str (dbGet .User.ID "modmenu").Value) "mute"}}
{{deleteAllMessageReactions nil (str .Reaction.MessageID)}}
{{addMessageReactions nil (str .Reaction.MessageID) "β"}}
{{editMessage nil (str .Reaction.MessageID) (cembed
"author" $author
"description" (exec "mute" $userid $mute "Muted by Mod Panel")
"color" 0x77FF68)}}
{{end}}
{{if eq (str (dbGet .User.ID "modmenu").Value) "ban"}}
{{deleteAllMessageReactions nil (str .Reaction.MessageID)}}
{{addMessageReactions nil (str .Reaction.MessageID) "β"}}
{{editMessage nil (str .Reaction.MessageID) (cembed
"author" $author
"description" (exec "ban" $userid $ban "Banned by Mod Panel")
"color" 0x77FF68)}}
{{end}}
{{end}}
{{end}}
{{end}}
{{end}}