Join Trigger
This code tracks incoming members to a server. If their account age is less than some value (1 day by default), they are added to the raid list. If the raid list exceeds some number, a notification is sent in a staff channel warning about a possible raid.
For more information about the raid guard system, see this page.
Every 10 minutes, the list resets to account for any members not part of a raid.
Trigger
This is not a custom command! Rather, it's meant to be added to your Join Feed.
Configuration
$age
Account age threshold for members to be added to the raid list in minutes.$len
Length of the raid list at which a notification is sent.📌
$rolemention
List of role IDs to mention if a possible raid is detected.📌
$channel
Channel to send notifications in if a possible raid is detected.
Code
{{/*
Tracks new members to a server for the anti-raid system.
See <https://yagpdb-cc.github.io/moderation/raid-guard/join-trigger> for more information.
Author: ENGINEER15 <https://github.com/engineer152/>
*/}}
{{/* Configurable values */}}
{{$age := 1440}}
{{$len := 25}}
{{$rolemention := cslice 123 234}}
{{$channel := 123}}
{{/* Configurable values end */}}
{{/* ACTUAL CODE - DO NOT TOUCH */}}
{{$newmem := .User}}
{{$l:=cslice}}
{{with (dbGet 0 "raidlist").Value}}
{{$l = $l.AppendSlice . }}{{end}}
{{ if not (dbGet 0 "raidlistcool")}}
{{dbDel 0 "raidlist"}}{{end}}
{{$embed := cembed
"title" " ⚠ RAID ALERT!"
"description" "I have determined that there are more than:\n**25 BRAND NEW ACCOUNTS**\nthat just joined the server!\n\n__Options:__\n1. `-raid kick` - Kicks all raid members.\n2. `-raid ban` - Bans all raid members.\n3. `-raid clear` - Clear Raid List"
"color" (randInt 16777217)
"thumbnail" (sdict "url" "https://cdn.discordapp.com/emojis/565142262401728512.png" )}}
{{if lt (currentUserAgeMinutes) $age}}
{{if not (dbGet $newmem.ID "raidcooldown") }}
{{$l = $l.Append $newmem}}
{{dbSet 0 "raidlist" $l}}
{{$mentions := cslice}}
{{range $rolemention}} {{- $mentions = $mentions.Append (print "<@&" . ">") -}} {{end}}
{{if eq (len $l) $len}}
{{sendMessageNoEscape $channel (complexMessage "content" (joinStr ", " $mentions.StringSlice) "embed" $embed) }}
{{end}}
{{dbSetExpire $newmem.ID "raidcooldown" true 3600}}
{{dbSetExpire 0 "raidlistcool" true 1200 }}
{{end}}
{{end}}
Author
This custom command was written by @ENGINEER15.