-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathdowntime_announcement.yag
29 lines (25 loc) · 1.28 KB
/
downtime_announcement.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
{{/*
YAGPDB Downtime Announcement
Trigger: 5 Minutes
Trigger Type: Interval
Note: If you set this up for the first time it will create an example downtime announcement so you can see if it works.
Also make sure you select a 'Channel' when you are using an interval cc or else it will not work!
Copyright (c): Black Wolf, 2021
License: MIT
Repository: https://github.com/BlackWolfWoof/yagpdb-cc/
*/}}
{{/*Downtime*/}}
{{$dbtime := (dbGet $.BotUser.ID "downtime").Value}}{{$ctime := currentTime}}{{$firsttime := ""}}
{{if not $dbtime}}
{{$firsttime = " - ❗Example❗"}}
{{$dbtime = mult -3510 .TimeSecond|toDuration|$ctime.Add}}
{{end}}
{{if $dbtime.Before (mult -8 .TimeMinute|toDuration|$ctime.Add)}}
{{sendMessage nil (cembed
"author" (sdict "url" "https://yagpdb.xyz/status/" "icon_url" "https://cdn.discordapp.com/emojis/705738821110595607.png" "name" (print "YAGPDB Downtime Announcement" $firsttime))
"description" (print "YAGPDB was down for the last **≈ " ($ctime.Sub $dbtime|humanizeDurationSeconds) "**\n\nFrom: 📅<t:" $dbtime.Unix ":d> ⌚<t:" $dbtime.Unix ":T>\nTo:\u2003\u200A\u2005📅<t:" $ctime.Unix ":d> ⌚<t:" $ctime.Unix ":T>")
"color" 0xbf172e
"timestamp" $ctime)}}
{{end}}
{{$dbtime := toDuration "90s"|$ctime.Add}}
{{dbSet $.BotUser.ID "downtime" $dbtime}}