$setGuildMemberVar[]
$setGuildMemberVar stores a value persistently in the BDFD database under a guild-member-scoped variable. The context key is composed as guildId:userId, making the value unique per user per server. $setMemberVar is an exact alias.
Syntax
$setGuildMemberVar[name;value] or $setGuildMemberVar[name;value;User ID] or $setGuildMemberVar[name;value;User ID;Guild ID]
When called with two arguments, it sets the variable for the current command author in the current guild. When a User ID is provided, it sets for that user in the current guild. When both User ID and Guild ID are provided, it sets for the exact guild-member combination. An empty User ID or Guild ID counts as omitted. The function takes 2 to 4 arguments. If the server or the user is missing (for example in a DM), the error A server and user are required for guildMember variables. is raised.
The scope is guildMember. Writing: the value (any text, stored as a string) is stored for the selected context. The variable does not have to be declared beforehand: if no variable with this name is declared for this scope in the Variables catalogue, the first write declares it, using the written value as its default value, so any context that has no stored value then reads that first value instead of an empty string. The name is trimmed, a leading bc_ is ignored, and an empty name raises an error. Stored values are case-sensitive (Score and score are two different values). It is ideal for per-user-per-server data like XP, warnings, ranks, inventory, economy balances (server-specific), and moderation records. This function does not return any output (empty string) — use $getGuildMemberVar to read. To reset, use $resetGuildMemberVar.
Examples
Assign Guild Member Rank
$setGuildMemberVar[rank;Veteran;$authorID;$guildID]
$title[Rank Updated]
$description[<@$authorID> is now assigned rank **Veteran** on this server!]
$color[#9B30FF]
Try it
Paste an example into the playground to preview its message (functions that act on Discord are not run), or build the same thing with blocks.