Skip to content

Old JagTag

John Grosh edited this page Jun 3, 2017 · 1 revision

JagTag Notation

(Also check out the JagTag#examples at the bottom!)

Simple Replacements

JagTag Syntax Description Example Usage Example Output
{user} The user’s username Hello, {user}! Hello, jagrosh!
{userid} The user’s Discord ID Your ID is {userid} Your ID is 113156185389092864
{nick} The user’s nickname if they have one, otherwise their username Hello, {nick}! Hello, jag!
{discrim} The user’s discriminator You are #{discrim} You are #4824
{server} The name of the server (or “Direct Message”) Welcome to {server}! Welcome to Spectra Lounge!
{serverid} The Discord ID of the server (or 0 in DMs) This server’s ID is {serverid} This server’s ID is 147698382092238848
{servercount} The number of users on the server (or 1 in DMs) Wow! {servercount} users! Wow! 427 users!
{channel} The current channel (or “#Direct Message”) {channel} is for serious chat only bug_reports is for serious chat only
{channelid} The id of the current channel (or 0 in DMs) This channel has id {channelid} This channel has id 159849755294302208
{args} Any additional text that is passed in (tags only) You said “{args}” You said “cool tag bro”
{argslen} The number of arguments (arguments are separated by whitespace) You said {argslen} words You said 3 words
{avatar} The url of the user’s avatar (or nothing if they don’t have an avatar) Here’s your avatar: {avatar} Here’s your avatar: https://cdn.discordapp.com/....jpg
{nsfw} Marks a tag as Not Safe For Work [REDACTED] {nsfw} In NSFW channel : [REDACTED]
In regular channel : This tag has been marked as Not Safe For Work

Random Replacements

JagTag Syntax Description Example Usage Example Output
{randuser} A random user (when used in a server, a random user on that server) Please talk to {randuser}! Please talk to Frost
{randonline} A random online user (when used in a server, a random online user on that server) Ask {randonline} for me Ask Frost for me
{randchannel} A random text channel on the server (or #sometestchannel in DMs) Go check out the drama in {randchannel} Go check out the drama in off-topic

Complex Replacements

JagTag Syntax Description Example Usage Example Output
{choose:ITEM 1|ITEM 2|ITEM 3} Makes a random choice among the included items. Items must be separated by the pipe character (|), and there can be as many choices as you want. The magic 8 Ball says: {choose:Yes|No|Definitely not|Maybe|Try again later|It is unknown} The magic 8 Ball says: Maybe
{range:INT1|INT2} Picks a random integer betweent he first (inclusive) and the second (exclusive). The order does not matter (the lower number can be either the first or second) It's over {range:300|30000}! It's over 9000!
{lower:TEXT} Makes all text lowercase Let's just {lower:CaLM DoWN!!}! Let's just calm down!!!
{upper:TEXT} Makes all text uppercase Let's just {upper:cAlm dOwn!!}! Let's just CALM DOWN!!!
{length:TEXT} Returns the number of characters in the given text The word "pizza" is {length:pizza} characters long The word "pizza" is 5 characters long
{url:TEXT} Converts text to UTF-8 URL encoding lmgtfy.com/?q={url:this is a cool search} lmgtfy.com/?q=this+is+a+cool+search
{user:TEXT} Searches for a username given the input. If no user is found, an error will be returned Say hi to {user:jag} for me Say hi to jagrosh for me
{nick:TEXT} Searches for a user given the input. If no user is found, an error will be returned. This is the same as {user:TEXT} but it will give the user's nickname Say hi to {nick:jag} for me Say hi to Mr. jagrosh for me
{arg:NUMBER} Gives the corresponding-numbered argument (tags only). This number is taken modulus the number of arguments, so unless no arguments are provided, no argument index will be out of range You said {arg:0} and {arg:1} You said Hello and World
{replace:TXT1 |with:TXT2 |in:TXT3} Swaps certain bits of text with some other bit of text According to him, {replace:did|with:did not|in:he did tell them to be quiet, and they did} According to him, he did not tell them to be quiet, and they did not
{replaceregex:REGEX |with:TXT2 |in:TXT3} Swaps all matches of a regex with some other bit of text My favorite numbers are {replaceregex:\d+|with:[REDACTED]|in:57, 345, and 9000} My favorite numbers are [REDACTED], [REDACTED], and [REDACTED]
{math:NUM |OP |NUM} Performs basic math. Operations are: + - * / and %. Multiple operations can be used in a single math replacement 40000 minutes is the same as {math:40000|/|60|/|24} days 40000 minutes is the same as 27.777777777777775 days
{if:VAL|COMP|VAL |then:TXT |else:TXT} Performs a conditional check. Values can be textual or numerical. Possible comparitors are <, >, =, ?, or ~. For numbers, ~ is a check for equality when rounding to 2 decimal places. For strings, ~ is a case-insensitive equals. For both types, ? is matching a regex I'm feeling {if:THIS|~|this|then:like this|else:like that}. I'm feeling like this
{set:VAR|VALUE} Sets a temporary variable to a value. Values can be numerical or text. Variables only persist during interpretation Let's set a value {set:myVar|57} Let's set a value
{get:VAR} Gets the value of a variable that has been set Let's get a value {get:myVar} Let's get a value 57
{note:TEXT} Gets removed at interpretation (like a comment). This is {note:not actually} cool This is cool

Examples:

  • Mention a user: <@{userid}>
  • Give a response only if one is provided: {if:{argslen}|=|0|then:Please say something|else:{nick} said: {args}}
  • Give the number of users in a server only if it is a multiple of 100: {if:{math:{servercount}}|%|100}|=|0|then:That's {servercount} users!|else:}
  • Pick a random phrase: I ate {choose:too many|a lot of|a big pile of|{range:0|100}|2 and a half} cookies!