forked from BlackWolfWoof/yagpdb-cc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
regex.yag
27 lines (23 loc) · 1.18 KB
/
regex.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
{{/*
Trigger type: Regex
Trigger: \A
Copyright (c): Black Wolf, 2021
License: MIT
Repository: https://github.com/BlackWolfWoof/yagpdb-cc/
*/}}
{{/*NOTE: YOU NEED THE 'sticky message 2 command.gtmpl' CODE FOR THIS TO WORK*/}}
{{$whitelist := false}}
{{/*This enables the whitelist of channels where it should run*/}}
{{$channels := cslice 166207328570441728 384011387132706816}}
{{/*Replace these channel id's with your channels if you have enabled the whitelist*/}}
{{if not $whitelist}}{{$channels = cslice .Channel.ID}}{{end}}
{{if and (dbGet 0 "stickymessage") (dbGet .Channel.ID "smcooldown"|not) (in $channels .Channel.ID)}}
{{$db := (dbGet 0 "stickymessage").Value}}
{{$message := cembed "author" (sdict "name" (print "Sticky message by " $db.author) "icon_url" "https://cdn.discordapp.com/emojis/587253903121448980.png") "color" $db.color "description" $db.message "image" (sdict "url" (or $db.img ""))}}
{{if $db := dbGet .Channel.ID "smchannel"}}
{{deleteMessage nil (toInt $db.Value) 0}}
{{end}}
{{$id := sendMessageRetID nil $message}}
{{dbSet .Channel.ID "smchannel" (str $id)}}
{{dbSetExpire .Channel.ID "smcooldown" true (toInt (toDuration $db.cooldown).Seconds)}}
{{end}}