Skip to main content

Nickname Moderation

Helps moderate inappropriate or unpingable nicknames. Instead of having to change members' nicknames manually, staff members can moderate nicknames with a single command.

note

Due to limitations for editing nicknames in YAGPDB template scripting, the offending member's nickname will be edited once they send another message, not when you run the command.

Trigger

Type: Regex
Trigger: \A
Additional options: Errors as custom command output disabled

Usage

  • -modnick <user> - Changes the nickname of the user provided.
  • -unmodnick <user> - Changes the nickname of a user previously moderated using this command to its original value.
  • -nick-numerreset - Makes the next moderated nickname start at 1.

Configuration

  • $name
    What should be in front of the auto-generated nicknames when a nickname is moderated.

  • $padding
    How many digits the number should have.
    Recommended value: Between 3 and 7.

  • $modPerms
    Permissions required to moderate nicknames.

    Available permissions:
    • 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

Code

{{/*
Moderates nicknames.
See <https://yagpdb-cc.github.io/moderation/nickname-moderation> for more information.

Author: 2x2Master1 <https://github.com/2x2master1>
*/}}

{{/* Configurable values */}}
{{$name := "Moderated Nickname"}}
{{$padding := "5"}}
{{$modPerms := .Permissions.ManageMessages}}
{{/* End of configurable values */}}

{{$mod := hasPermissions $modPerms}}
{{$prefix := .ServerPrefix}}
{{if .CmdArgs}}
{{if eq (lower (index .CmdArgs 0)) (print $prefix "modnick")}}
{{if ge (len .CmdArgs) 2}}
{{if $mod}}
{{((userArg (index .CmdArgs 1)).String)}}'s nickname will be moderated when they next send a message.
{{dbSet ((userArg (index .CmdArgs 1)).ID) "nick" 1}}
{{else}}
{{sendMessage nil (print .User.Mention ", you can't use that.")}}
{{end}}
{{else}}
{{sendMessage nil (print .User.Mention ", please provide a user!")}}
{{end}}
{{else if (eq (lower (index .CmdArgs 0)) (print $prefix "unmodnick"))}}
{{if ge (len .CmdArgs) 2}}
{{if $mod}}
{{((userArg (index .CmdArgs 1)).String)}}'s nickname will not be moderated anymore.
{{dbSet ((userArg (index .CmdArgs 1)).ID) "nick" 0}}
{{else}}
{{sendMessage nil (print .User.Mention ", you can't use that.")}}
{{end}}
{{else}}
{{sendMessage nil (print .User.Mention ", please provide a user!")}}
{{end}}
{{else if (eq (lower (index .CmdArgs 0)) (print $prefix "nick-numberreset"))}}
{{if $mod}}
{{dbSet 0 "mnick" 0}}
{{addReactions "✅"}}
{{else}}
{{sendMessage nil (print .User.Mention ", you can't use that.")}}
{{end}}
{{else if eq (toInt ((dbGet .User.ID "nick").Value)) 1}}
{{if or (ne (reFind $name .Member.Nick) $name) (not .Member.Nick)}}
{{$db := dbIncr 0 "mnick" 1}}
{{$db2 := toInt ($db)}}
{{$v := printf (print "%0" $padding "d") $db2}}
{{editNickname (print $name " " $v)}}
{{end}}
{{end}}
{{end}}

Author

This custom command was written by @2x2Master1.