-
Notifications
You must be signed in to change notification settings - Fork 66
/
dbdelmap.yag
41 lines (38 loc) · 2.33 KB
/
dbdelmap.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
{{/*
Trigger: dbdelmap
Trigger Type: Command
Usage:
dbdelmap ID/Mention Key SdictName
Copyright (c): Black Wolf, 2021
License: MIT
Repository: https://github.com/BlackWolfWoof/yagpdb-cc/
*/}}
{{$perms := "Administrator"}}
{{/*The bot will check if the user has this permission.
Permissions available: Administrator, ManageServer, ReadMessages, SendMessages, SendTTSMessages, ManageMessages, EmbedLinks, AttachFiles, ReadMessageHistory, MentionEveryone, VoiceConnect, VoiceSpeak, VoiceMuteMembers, VoiceDeafenMembers, VoiceMoveMembers, VoiceUseVAD, ManageNicknames, ManageRoles, ManageWebhooks, ManageEmojis, CreateInstantInvite, KickMembers, BanMembers, ManageChannels, AddReactions, ViewAuditLogs*/}}
{{if (in (split (index (split (exec "viewperms") "\n") 2) ", ") $perms)}}
{{$prefix := index (reFindAllSubmatches `Prefix of \x60\d+\x60: \x60(.+)\x60` (exec "prefix")) 0 1}}
{{$args := parseArgs 2 (print $prefix "dbdelmap <ID/Mention> <Key> <SdictName>")
(carg "userid" "id")
(carg "string" "key")
(carg "string" "sdictname")}}
{{$user := userArg ($args.Get 0)}}{{$userm := print "`" ($args.Get 0) "`"}}
{{with $user}}{{$userm = .Mention}}{{end}}
{{$t1 := (dbGet ($args.Get 0) ($args.Get 1))}}
{{if $t1}}
{{$db := sdict $t1.Value}}
{{if kindOf ($db.Get ($args.Get 2))}}
{{$db.Del ($args.Get 2)}}
{{dbSet ($args.Get 0) ($args.Get 1) $db}}
{{$embed := sdict "color" 0x00D66C "title" "\\🗑️ Deleted database map entry" "description" (print "<:checkmark:705738821425299527> Deleted `" ($args.Get 2) "` in `" ($args.Get 1) "` from " $userm ".")}}
{{if $user}}{{$embed.Set "thumbnail" (sdict "url" (print "https://cdn.discordapp.com/avatars/" ($args.Get 0) "/" $user.Avatar ".png?size=4096"))}}{{end}}
{{sendMessage nil (cembed $embed)}}
{{else}}
{{sendMessage nil (cembed "color" 0xDD2E44 "title" "Something unexpected happened! :(" "description" "<:cross:705738821110595607> This database entry map name doesn't exist!")}}
{{end}}
{{else}}
{{sendMessage nil (cembed "color" 0xDD2E44 "title" "Something unexpected happened! :(" "description" "<:cross:705738821110595607> This database entry doesn't exist!")}}
{{end}}
{{else}}
{{sendMessage nil (cembed "title" "Missing permissions" "description" (print "<:cross:705738821110595607> You are missing the permission `" $perms "` to use this command!") "color" 0xDD2E44)}}
{{end}}