Skip to main content
Vanity and Server Tag roles are part of Petto. A rule gives (or takes away) a role when a member’s Discord profile matches: the text of their Custom Status, their username, global name, server nickname or display name, or the Server Tag they wear.
Both work with the prefix and as slash commands (/vanity and /guildtag), which are easier when a rule has several options. You can also manage all of it from the dashboard, under Vanity roles. Short names with the prefix: !vy for !vanity, !tag, !gt or !servertag for !guildtag, and !idlog for !identity.

What it can do

  • Match a member’s Custom Status text or profile name and manage a role.
  • Match the Server Tag a member wears (its server, its text, or whether they show one) and manage a role.
  • Keep a role safe when several rules use it, and never take away a role someone was given by hand.
  • Thank the member in a channel when a rule starts matching, with a saved embed from Embeds (classic or V2) if you like.
  • Log every role the rules add or remove, with a Petto card or a saved embed for each kind of entry.
  • Check everyone at once with a live progress bar.

First-time setup

  1. Give Petto Manage Roles and move its role above every role a rule should add or remove (Server Settings → Roles). Discord rejects a role change otherwise.
  2. Custom Status rules need Petto’s Presence Intent, which is already on.
  3. Create a rule, then check it with !vanity test and apply it with !vanity sync.
liam creates the rule cinnamochi, tests chu, whose status matches, and syncs: 1,840 members checked and 12 roles added

In Discord: step 3: create a rule, test it on a member, then apply it to everyone.

You can only create rules for roles below your own highest role (the owner can use any role Petto can give). This keeps a moderator from handing themselves higher roles through a rule.
kira tries a rule that gives Admin and Petto answers in red that she can only use roles below her highest role

In Discord: a moderator cannot make a rule for a role above their own highest role.

Vanity rules

Sources

Create a rule

liam creates the rule cinnamochi for the Rep role and Petto confirms, with a tip to run !vanity sync

In Discord: !vanity add with the defaults.

liam creates the rule with --source, --comparison and --action and Petto confirms

In Discord: the same rule with every option written as a flag.

  • name: a short name for the rule (letters, numbers, - and _);
  • word: the text to look for (up to 200 characters);
  • role: the role the rule manages;
  • source: where to look (default custom_status);
  • comparison: equals, contains (default), starts_with, ends_with or regex;
  • action: add_role (default) or remove_role.
With the slash command (/vanity add or /guildtag add) Discord asks for each option one by one and shows the choices, so you do not have to remember the words. The other commands below work the same way: /vanity list, /vanity test, /vanity sync and so on. Capital letters and extra spaces do not matter. A regex is limited to 256 characters, and a pattern that does not compile is refused when you save the rule.
kira saves a regex rule with an open parenthesis and Petto answers in red that the pattern is not valid

In Discord: a regex that does not compile is refused when the rule is saved.

Other commands

Petto lists two rules that give Rep, invite-link marked off, and the thank-you channel

In Discord: the rules, the one that is off, and where thank-yous go.

liam runs !vanity edit invite-link --enabled true and Petto confirms the rule was updated

In Discord: !vanity edit turns a rule back on.

liam removes invite-link and Petto confirms

In Discord: !vanity remove deletes a rule.

Petto shows chu's Custom Status, the rule cinnamochi that matches and invite-link that does not

In Discord: !vanity test: what each rule says about a member, without changing anything.

Petto's progress card at 60%, 1,104 of 1,840 members, 48 per second, about 16 seconds left

In Discord: !vanity sync while it runs: the progress bar, the count and the time left.

Petto says the Vanity rules were synced: 1,840 members checked in 38 seconds, 12 roles added and 3 removed

In Discord: when the sync ends: members checked and roles added and removed.

liam syncs chu and Petto says it checked chu, with 1 role change

In Discord: !vanity sync for one member.

Petto explains that the role is taken away when a member goes offline, then confirms that members now keep it

In Discord: !vanity offline shows the setting; with keep it changes it.

When a member goes offline

Discord hides the Custom Status of a member who is offline or invisible. Each server chooses what Petto does with the role then, with !vanity offline (or /vanity offline) or in the dashboard, under Vanity roles:
  • remove (the default): when Discord says the member went offline, Petto takes the role away. It gives it back when they are online with a matching Custom Status, and it thanks them again.
  • keep: the member keeps the role until they are online again, and it only goes when Petto sees the status stop matching.
Petto only takes away roles it gave itself, never a role someone gave by hand. !vanity sync follows the same setting: with the default it asks Discord for the members with their presences and takes the role from those who are offline. If Discord is rate limited and Petto has to use what it remembers, offline members are left alone and the result says it is incomplete. A member Petto has no presence for is never changed, so a restart or a sweep cannot strip the roles of people who are online. Rules that read the name or the nickname are not affected: those are always visible. If the same role is also managed by another rule that still matches (a name rule, or a Server Tag rule), the role stays.
With remove, roles come and go as people go online and offline. If you have a log of role changes, it will show those changes: turn off the Vanity events you do not need in the log, or choose keep.
The Vanity rules page with the offline setting, the Create a rule form and two rules that give the Rep role

Dashboard → Vanity roles → Vanity rules: what happens when a member goes offline, the form to create a rule and the rules of the server.

Server Tag rules

liam creates the rules partner, for a server ID, and shows-tag, and Petto confirms each one

In Discord: the two example rules of Server Tags.

!guildtag has the same list, edit, remove, test, sync, notify and notify-off as !vanity.
Petto lists the Server Tag rules shows-tag and partner with their roles

In Discord: !guildtag list.

Petto shows that shi wears the tag PETO, that shows-tag matches and partner does not

In Discord: !guildtag test: the tag Petto reads and which rules match.

Discord does not always send an event when someone changes their Server Tag. If a change was missed, !guildtag sync (or !identity sync) catches up.
Petto says the Server Tag rules were synced: 1,840 members checked, 4 roles added and 1 removed

In Discord: !guildtag sync catches up.

The Server Tag rules page with the Create a rule form and the rules partner and shows-tag

Dashboard → Vanity roles → Server Tag rules: the form to create a rule and the rules of the server.

How roles stay safe

  • A role stays while at least one add rule matches and no remove rule does (a remove rule always wins).
  • Petto only takes a role away if it remembers adding it itself. A role someone gave by hand is never removed, even if a rule later matches and stops matching.
  • If the bot cannot read a value right now (the Custom Status of someone who is offline or invisible, because Discord hides it, or someone it has no presence for), the rule leaves their role as it is instead of treating it as empty. The role is only taken away when they are online and the status no longer matches.
  • Bots are never changed.
  • Several rules can manage the same role: it is one role. It stays while at least one add rule matches, goes when none does (and no remove rule matches), and the member is thanked once for each source (Vanity and Server Tag), not once per rule. A role that both a Vanity rule and a Server Tag rule manage is still one role.

Thank-you messages

liam sets the Vanity thank-you in thanks and Petto confirms

In Discord: the default thank-you in a channel.

liam sets the thank-you with the embed my-embed and Petto confirms

In Discord: with a saved embed and no ping.

liam sets the Server Tag thank-you in tags and Petto confirms

In Discord: the Server Tag thank-you.

liam turns the thank-you off and Petto confirms

In Discord: !vanity notify-off.

embed is the name of a saved embed from Embeds (leave it empty for the simple message). With the slash command (/vanity notify, /guildtag notify) Discord lists your saved embeds under the option while you type, so you only have to pick one and ping is user (default) or none. The message is sent when a member starts matching a rule, not on every update. Without a saved embed it is a card with the member’s picture, the role they now have and the word of the rule.
Petto thanks chu, who now has the Rep role, with chu's picture, the word cinnamochi and the name of the rule

In Discord: the default thank-you when a member starts matching a Vanity rule.

Petto's embed Vanity role added thanks chu, who now has Rep

In Discord: the thank-you made from the saved embed my-embed.

The Vanity thank-you in thanks with the default message, and the Server Tag one in tags with my-embed and no mention

Dashboard → Vanity roles → Thank-you messages: the channel, the message and the mention of each thank-you.

Log of role changes

liam sets the log in staff-log and Petto confirms, with how to choose the entries

In Discord: !identity logs sets the channel of the log.

liam turns off vanity_add and Petto says those entries are off

In Discord: one kind of entry turned off.

liam sets my-embed for tag_add and Petto confirms

In Discord: a saved embed for one kind of entry.

liam turns the log off and Petto confirms

In Discord: the log turned off.

The kinds of entry are vanity_add, vanity_remove, tag_add, tag_remove and error. Without a saved embed each one is the same green or red embed the Vanity bot used, with Petto’s emoji, the role and the member, and the word (Vanity) or the reason (Server Tag). Pick a saved embed for an entry only if you want a different look. !identity status shows the whole setup, and !identity sync applies every rule at once.
Petto's card with 2 Vanity rules and 1 Server Tag rule, the thank-you channels and the log channel with its entries

In Discord: !identity status: rules, thank-yous and log.

Petto says the rules were synced: 1,840 members checked, 15 roles added and 4 removed

In Discord: !identity sync applies every rule.

A green Vanity entry for chu, a green Server Tag entry for shi with its condition, and a red entry for the Rep role taken from kira

In Discord: three entries of the log, without a saved embed.

The Staff action log card with staff-log, the five kinds of entry on, and my-embed for Server Tag role added

Dashboard → Vanity roles → Vanity logs: the channel, the kinds of entry and the saved embed of each one.

Variables for the messages

Use these in saved embeds for the thank-you messages and the log (the full list with examples is in Variables, and in Variables in the dashboard):
For a custom_status rule, {vanity.value} is the member’s current Custom Status. In a Server Tag message, {tag} is the text of the tag. All the usual variables ({user.mention}, {guild.name}…) work too.

Roles that come back

Sticky roles (!stickyroles enable) give a member their roles back when they leave and rejoin. The roles of Vanity and Server Tag rules are the exception: the rules give them again if the member still matches.

Coming from the Vanity bot

The old Vanity bot is no longer needed. Its data (rules, who got which role, thank-you messages, log settings and saved embeds) is imported into Petto once by the team, so nothing is lost and no role is taken away. Messages that used the old variable names ({role}, {action.text}, {event.title}…) are updated to the new ones ({rule.role}, {rule.action_text}, {rule.event_title}…).

Troubleshooting

The role is not added

  1. Petto has Manage Roles and its role is above the target role.
  2. The right source was chosen (custom_status is not the username).
  3. The text matches the comparison. Try !vanity test @member.
  4. Run !vanity sync after changing a rule.

The role is not taken away

  1. The server may be set to keep (!vanity offline): then a member who is offline or invisible keeps the role, because Discord hides their Custom Status. Use !vanity offline remove (the default) if you want it to go when they go offline.
  2. Petto only takes away roles it gave itself. A role someone gave by hand stays.
  3. If another rule that manages the same role still matches, the role stays. Check with !vanity test @member.

The thank-you message does not arrive

Check !identity status, that the channel is a text channel Petto can write in, and that the saved embed exists. The message is sent when a rule starts matching; the same unchanged match does not repeat it.

The Server Tag looks empty or late

Discord may omit or delay Server Tag data. Use !guildtag test @member to see what Petto reads and !guildtag sync to catch up.