menu

blargbot is equipped with a system of tags called BBTag, designed to mimic a programming language while still remaining simple. You can use this system as the building-blocks to create your own advanced command system, whether it be through public tags or guild-specific custom commands.

Have a suggestion for a tag? I'm all ears! Drop me a suggestion using b!suggest or come by my guild to talk to me in person.

Editor

There is also an online BBTag IDE (in beta) that you can use to see the contents of your custom command a little bit easier. Feel free to give it a try!

Features

Variables

BBTag features four different types of variables, each with a different scope. These types are distinguished from each other with prefixes.

Arrays

BBTag has array implementation for more complex data stuctures.

Simple Tags

These subtags are just simple replaces, and don't take any arguments.

argsarray

Gets user input as an array.

Example Code:

Your input was {argsarray}

Example Input:

Hello world!

Example Output:

Your input was ["Hello","world!"]

argslength

Return the number of arguments the user provided.

Example Code:

You said {argslength} words.

Example Input:

I am saying things.

Example Output:

You said 4 words.

channelid

Returns the ID of the current channel.

Example Code:

This channel's id is {channelid}

Example Output:

This channel's id is 1234567890123456

channelname

Returns the name of the current channel.

Example Code:

This channel's name is {channelname}

Example Output:

This channel's name is test-channel

channelpos

Returns the position of the current channel.

Example Code:

This channel is in position {channelpos}

Example Output:

This channel is in position 1

commandname

Gets the name of the current tag or custom command. Will throw an error in other instances.

Example Code:

This command is {commandname}

Example Output:

This command is test

guildicon

Returns the icon of the current guild.

Example Code:

The guild's icon is {guildicon}

Example Output:

The guild's icon is (icon url)

guildid

Returns the id of the current guild.

Example Code:

The guild's id is {guildid}

Example Output:

The guild's id is 1234567890123456

guildmembers

Returns an array of user IDs of the members on the current guild.

Example Code:

This guild has {length;{guildmembers}} members.

Example Output:

This guild has 123 members.

guildname

Returns the name of the current guild.

Example Code:

This guild's name is {guildname}.

Example Output:

This guild's name is TestGuild.

guildownerid

Returns the id of the guild's owner.

Example Code:

The owner's id is {guildownerid}.

Example Output:

The owner's id is 1234567890123456.

guildsize (inguild)

Returns the number of members on the current guild.

Example Code:

This guild has {guildsize} members.

Example Output:

This guild has 123 members.

iscc

Checks if the tag is being run from within a cc. Returns a boolean (true or false)

Example Code:

{if;{iscc};{dm;{userid};You have mail!};Boo, this only works in cc's}

Example Output:

Boo, this only works in cc's

lb

Will be replaced by { on execution.

Example Code:

This is a bracket! {lb}

Example Output:

This is a bracket! {

messageid

Returns the ID of the invoking message.

Example Code:

The message id was {messageid}

Example Output:

The message id was 111111111111111111

prefix

Gets the current guild's prefix.

Example Code:

Your prefix is {prefix}

Example Output:

Your prefix is b!

randuser

Returns the id of a random user on the current guild.

Example Code:

{username;{randuser}} is a lovely person! {username;{randuser}} isn't as good.

Example Output:

abalabahaha is a lovely person! stupid cat isn't as good.

rb

Will be replaced by } on execution.

Example Code:

This is a bracket! {rb}

Example Output:

This is a bracket! }

semi

Will be replaced by ; on execution.

Example Code:

This is a semicolon! {semi}

Example Output:

This is a semicolon! ;

zws

Will be replaced by a single zero width space (unicode 200B)

Example Code:

{zws}

Example Output:

Complex

These subtags are more powerful.
<> - denotes required arguments
[] - denotes optional arguments
... - denotes one or more arguments

General

General purpose subtags.

//

Arguments: anything

A subtag that just gets removed. Useful for documenting your code.

Example Code:

This is a sentence. {//;This is a comment.}

Example Output:

This is a sentence.

abs (absolute)

Arguments: <number...>

Gets the absolute value of number. If multiple are supplied, then an array will be returned

Example Code:

{abs;-535}

Example Output:

535

args

Arguments: [index] [range]

Gets user input. Specifying index will only get the word at that location, specifyingrange will get all the words between index and range. Specify range as n to get allthe words from index to the end

Example Code:

Your second word was {args;1}

Example Input:

Hello world!

Example Output:

Your second word was world!

base (radix)

Arguments: <integer> [origin] <radix>

Converts a Base origin integer into a base radix number. Default origin is 10. radix must be between 2 and 36.

Example Code:

{base;255;16}

Example Output:

FF

base64decode (atob)

Arguments: <base64>

Converts the provided base64 to a UTF-8 string.

Example Code:

{base64decode;RmFuY3kh}

Example Output:

Fancy!

base64encode (btoa)

Arguments: <text>

Converts the provided text to base64.

Example Code:

{base64encode;Fancy!}

Example Output:

RmFuY3kh

bool

Arguments: <evaluator> <arg1> <arg2>

Evaluates arg1 and arg2 using the evaluator and returns true or false. Valid evaluators are ==, !=, >=, >, <=, <, startswith, endswith, includes
The positions of evaluator and arg1 can be swapped.

Example Code:

{bool;<=;5;10}

Example Output:

true

brainfuck

Arguments: <code> [input]

Interprets code as brainfuck, using input as the text for ,.

Example Code:

{brainfuck;++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.}

Example Output:

Hello World!

capitalize

Arguments: <text> [lower]

Capitalizes the first letter of text. If lower is specified the rest of the text will be lowercase

Example Code:

{capitalize;hello world!}

Example Output:

Hello world!

choose

Arguments: <choice> <options...>

Chooses from the given options, where choice is the index of the option to select.

Example Code:

I feel like eating {choose;1;cake;pie;pudding} today.

Example Output:

I feel like eating pie today.

clean

Arguments: <text>

Removes all duplicated whitespace from text, meaning a cleaner output.

Example Code:

{clean;Hello!


Im here to help}

Example Output:

Hello!
Im here to help

color (colour)

Arguments: <color>

Attempts to convert color to a hex code. color can be a HTML color, hex, (r,g,b) or a valid color number.

Example Code:

{color;pink}

Example Output:

ffc0cb

commit

Arguments: [variables...]

For optimization reasons, variables are not stored in the database immediately when you use {set}. Instead they are cached, and will be saved to the database when the tag finishes. If you have some variables that you need to be saved to the database immediately, use this to force an update right now.
This comes at a slight performance cost, so use only when needed.
variables defaults to all values accessed up to this point.
{rollback} is the counterpart to this.

Example Code:

{set;var;Hello!}
{commit}
{set;var;GoodBye!}
{rollback}
{get;var}

Example Output:

Hello!

decrement

Arguments: <varName> [amount] [floor]

Decreases varName's value by amount. floor is a boolean, and if it is true then the value will be rounded down. amount defaults to 1. floor defaults to true

Example Code:

{set;~counter;0} {repeat;{decrement;~counter},;10}

Example Output:

-1,-2,-3,-4,-5,-6,-7,-8,-9,-10

delete

Arguments: [[channelId] <messageId>]

Deletes the specified messageId from channelId, defaulting to the message that invoked the command. If channelId is not provided, it defaults to the current channel. Only ccommands can delete other messages.

Example Code:

The message that triggered this will be deleted. {delete}

Example Output:

(the message got deleted idk how to do examples for this)

embed

Arguments: <embed>

Takes whatever input you pass to embed and attempts to form an embed from it. embed must be a valid json embed object.
This subtag works well with {embedbuild}. If attempting to use inside of a {send}, {edit} or {dm}, you should not include {embed}, and instead just pass the content direct to {send}/{edit}/{dm}
You can find information about embeds here (embed structure) and here (embed limits) as well as a useful tool for testing embeds here

Example Code:

{embed;{lb}"title":"Hello!"{rb}}

Example Output:

(an embed with "Hello!" as the title)

embedbuild (buildembed)

Arguments: <values...>

This tag is designed to allow you to generate embed code for {webhook} and {embed} with much less effort.
This tag uses a key/value system, with each entry in values looking like key:value.


Valid keys are:
title
description
url
color - can be a HTML color, hex, (r,g,b) or a valid color number.
timestamp
footer.icon_url
footer.text
thumbnail.url
image.url
author.name
author.url
author.icon_url
fields.name - Must have fields.value after. Cannot be empty.
fields.value - Must come after a fields.name. Cannot be empty
fields.inline - Must come after a fields.name


You can find information about embeds here (embed structure) and here (embed limits) as well as a useful tool for testing embeds here

Example Code:

{embedbuild;
title:hello!;
description:I am an example embed;
fields.name:Field 1;
fields.value:This is the first field!;
fields.name:Field 2;
fields.value:This is the next field and is inline!;
fields.inline:true
}

Example Output:

{"title":"hello!","description":"I am an example embed","fields":[{"name":"Field 1","value":"This is the first field!"},{"name":"Field 2","value":"This is the next field and is inline!","inline":true}]}

emoji

Arguments: <text> [amount]

Gets amount (or 5 if amount isn't specified) emojis related to text. There's a limit of 10 emojis.

Example Code:

{emoji;I am hungry;5}

Example Output:

🍔 🍕 😩 🍴 😐

exec

Arguments: <tag> [args]

Executes another tag, giving it args as the input. Useful for modules.

Example Code:

Let me do a tag for you. {exec;f}

Example Output:

Let me do a tag for you. User#1111 has paid their respects. Total respects given: 5

execcc

Arguments: <ccommand> [args]

Executes ccommand using args as the input. Useful for modules.

Example Code:

Let me do a ccommand for you. {execcc;f}

Example Output:

Let me do a ccommand for you. User#1111 has paid their respects. Total respects given: 5

fallback

Arguments: [message]

Should any tag fail to parse, it will be replaced with message instead of an error.

Example Code:

{fallback;This tag failed} {randint}

Example Output:

This tag failed

flag

Arguments: <code>

Returns the value of the specified case-sensitive flag code. Use _ to get the values without a flag.

Example Code:

{flag;a} {flag;_}

Example Input:

Hello, -a world!

Example Output:

world! Hello,

flagset

Arguments: <code>

Returns true or false, depending on whether the specified case-sensitive flag code has been set or not.

Example Code:

{flagset;a} {flagset;_}

Example Input:

Hello, -a world!

Example Output:

true false

for

Arguments: <variable> <initial> <comparison> <limit> [increment] <code>

To start, variable is set to initial. Then, the tag will loop, first checking variable against limit using comparison. If the check succeeds, code will be run before variable being incremented by increment and the cycle repeating.
This is very useful for repeating an action (or similar action) a set number of times. Edits to variable inside code will be ignored

Example Code:

{for;~index;0;<;10;{get;~index},}

Example Output:

0,1,2,3,4,5,6,7,8,9,

get

Arguments: <varName> [index]

Returns the stored variable varName, or an index within it if it is a stored array. You can use a character prefix to determine the scope of your variable.
Valid scopes are: _ (Server), @ (Author), * (Global), ~ (Temporary), none (Local). For more information, use b!t docs variable or b!cc docs variable

Example Code:

{set;var1;This is local var1}
{set;~var2;This is temporary var2}
{set;var3;this;is;an;array}
{get;var1}
{get;~var2}
{get;var3}

Example Output:

This is local var1
This is temporary var2
{"v":["this","is","an","array"],"n":"var3"}

guildcreatedat

Arguments: [format]

Returns the date the current guild was created, in UTC+0. If a format code is specified, the date is formatted accordingly. Leave blank for default formatting. See the moment documentation for more information.

Example Code:

This guild was created on {guildcreatedat;YYYY/MM/DD HH:mm:ss}

Example Output:

This guild was created on 2016/01/01 01:00:00

hash

Arguments: <text>

Returns the numeric hash of text, based on the unicode value of each individual character. This results in seemingly randomly generated numbers that are constant for each specific query.

Example Code:

The hash of brown is {hash;brown}.

Example Output:

The hash of brown is 94011702.

if

Arguments: <value1> [<evaluator> <value2>] <then> [else]

If evaluator and value2 are provided, value1 is evaluated against value2 using evaluator. If they are not provided, value1 is read as true or false. If the resulting value is true then the tag returns then, otherwise it returns else.
Valid evaluators are ==, !=, >=, >, <=, <, startswith, endswith, includes.

Example Code:

{if;5;<=;10;5 is less than or equal to 10;5 is greater than 10}.

Example Output:

5 is less than or equal to 10.

increment

Arguments: <varName> [amount] [floor]

Increases varName's value by amount. floor is a boolean, and if it is true then the value will be rounded down. amount defaults to 1. floor defaults to true

Example Code:

{set;~counter;0} {repeat;{increment;~counter},;10}

Example Output:

1,2,3,4,5,6,7,8,9,10

indexof

Arguments: <text> <searchfor> [start]

Finds the index of searchfor in text, after start. text can either be plain text or an array. If it's not found, returns -1.

Example Code:

The index of "o" in "hello world" is {indexof;hello world;o}

Example Output:

The index of "o" in "hello world" is 4

inject

Arguments: <code>

Executes any arbitrary BBTag that is within code and returns the result. Useful for making dynamic code, or as a testing tool ({inject;{args}})

Example Code:

Random Number: {inject;{lb}randint{semi}1{semi}4{lb}}

Example Output:

Random Number: 3

isnsfw

Arguments: [channelId]

Checks if channelId is a NSFW channel. channelId defaults to the current channel

Example Code:

{if;{isnsfw};Spooky nsfw stuff;fluffy bunnies}

Example Output:

fluffy bunnies

isstaff (ismod)

Arguments: [user] [quiet]

Checks if user is a member of staff. user defaults to the person running the tag. If the user cannot be found false will be returned.

Example Code:

{if;{isstaff};You are a staff member!;You are not a staff member :(}

Example Output:

You are a staff member!

lang

Arguments: <language>

Specifies which language should be used when viewing the raw of this tag

Example Code:

This will be displayed with js! {lang;js}.

Example Output:

This will be displayed with js!.

length

Arguments: <value>

Gives the amount of characters in value, or the number of elements if it is an array.

Example Code:

What you said is {length;{args}} chars long.

Example Input:

Hello

Example Output:

What you said is 5 chars long.

logic

Arguments: <operator> <values...>

Accepts 1 or more boolean values (true or false) and returns the result of operator on them. Valid logic operators are &&, ||, xor, ^, !.

Example Code:

{logic;&&;true;false}

Example Output:

false

lower

Arguments: <text>

Returns text as lowercase.

Example Code:

{lower;THIS WILL BECOME LOWERCASE}

Example Output:

this will become lowercase

math

Arguments: <operator> <values...>

Accepts multiple values and returns the result of operator on them. Valid operators are +, -, *, /, %, ^

Example Code:

2 + 3 + 6 - 2 = {math;-;{math;+;2;3;6};2}

Example Output:

2 + 3 + 6 - 2 = 9

max

Arguments: <numbers...>

Returns the largest entry out of numbers. If an array is provided, it will be expanded to its individual values

Example Code:

{max;50;2;65}

Example Output:

65

min

Arguments: <number...>

Returns the smallest entry out of numbers. If an array is provided, it will be expanded to its individual values.

Example Code:

{min;50;2;65}

Example Output:

2

newline

Arguments: [count]

Will be replaced by count newline characters (\n).

Example Code:

Hello,{newline}world!

Example Output:

Hello,
world!

nsfw

Arguments: [message]

Marks the output as being NSFW, and only to be sent in NSFW channels. A requirement for any tag with NSFW content. message is the error to show, defaults to "❌ This contains NSFW content! Go to a NSFW channel. ❌"

Example Code:

This command is not safe! {nsfw}

Example Output:

This command is not safe!

pad

This tag is deprecated. Avoid using it, as it will eventually become unsupported. Please use realpad instead

Arguments: <direction> <back> <text>

Places text ontop of back with it being aligned to the opposite of direction. If text is longer than back then it will simply overlap

Example Code:

{pad;left;000000;ABC}

Example Output:

000ABC

parsefloat

Arguments: <text>

Returns an floating point number from text. If it wasn't a number, returns NaN.

Example Code:

{parsefloat;abcd} {parsefloat;12.34} {parsefloat;1.2cd}

Example Output:

NaN 12.34 1.2

parseint

Arguments: <text>

Returns an integer from text. If it wasn't a number, returns NaN.

Example Code:

{parseint;abcd} {parseint;1234} {parseint;12cd}

Example Output:

NaN 1234 12

quiet

Arguments: [isQuiet]

Tells any subtags that rely on a quiet field to be/not be quiet based on isQuiet. isQuiet defaults to true

Example Code:

{quiet} {usermention;cat}

Example Output:

cat

randchoose

Arguments: <choices...>

Picks one random entry from choices. If an array is supplied, it will be exapnded to its individual elements

Example Code:

I feel like eating {randchoose;cake;pie;pudding} today

Example Output:

I feel like eating pudding today.

randint

Arguments: [min] <max>

Chooses a random whole number between min and max (inclusive). min defaults to 0.

Example Code:

You rolled a {randint;1;6}.

Example Output:

You rolled a 5.

randstr

Arguments: <chars> <length>

Creates a random string with characters from chars that is length characters long.

Example Code:

You rolled a {randint;1;6}.

Example Output:

You rolled a 5.

reactadd (addreact)

Arguments: [[channelId] <messageId>] <reactions...>

Adds reactions to the given messageId. If the messageId is not supplied, it instead adds the reactions to the output from the containing tag.
Please note that to be able to add a reaction, I must be on the server that you got that reaction from. If I am not, then I will return an error if you are trying to apply the reaction to another message.

Example Code:

{reactadd;:thinking:;:joy:}

Example Output:

(On message) 🤔(1) 😂(1)

reactlist (listreact)

Arguments: [[channelId] <messageId>] [reactions...]

Lists reaction data about the given messageId. If reactions is supplied, then a list of users who have added those reactions will be returned. If reactions is not supplied then a list of all reactions on the given messageId will be given.
messageId defaults to the command message.
channelId defaults to the current channel.

Example Code:

{reactlist}
{reactlist;:thinking:}

Example Output:

["🤔","😂"]
["1111111111111","2222222222222","1234567890123"]

reactremove (removereact)

Arguments: [channelId] <messageId> <[users...] [reactions]>

Removes reactions from messageId which were placed by users.
users defaults to the user who executed the tag.
reactions defaults to all reactions.
channelId defaults to the current channel.

Example Code:

{reactremove;12345678901234;:thinking:}

Example Output:

(removed the 🤔 reaction by the user)

realpad

Arguments: <text> <length> [filler] [direction]

Pads text using filler until it has length characters. filler is applied to the direction of text filler defaults to space, direction defaults to right.


This is how padding should be implemented, and the {pad} subtag is a sucks. The past me who thought it would be a good idea is also a sucks.

Example Code:

{realpad;ABC;6;0;left}

Example Output:

000ABC

regexreplace

Arguments: [text] <regex> <replaceWith>

Replaces the regex phrase with replacewith. If text is specified, the tag is replaced with the new toreplace. If not, it is run on the output from the containing tag.

Example Code:

I like {regexreplace;to consume;/o/gi;a} cheese. {regexreplace;/e/gi;n}

Example Output:

I likn ta cansumn chnnsn.

regexsplit

Arguments: <text> <regex>

Splits the given text using the given regex as the split rule

Example Code:

{regexsplit;Hello there, I am hungry;/[\s,]+/}

Example Output:

["Hello","there","I","am","hungry"]

regextest

Arguments: <text> <regex>

Tests if the regex phrase matches the text, and returns a boolean (true/false).

Example Code:

{regextest;apple;/p+/i} {regextest;banana;/p+/i}

Example Output:

true false

repeat (loop)

Arguments: <text> <amount>

Repeats text amount times. text will be interpreted as BBTag code

Example Code:

{repeat;e;10}

Example Output:

eeeeeeeeee

replace

Arguments: [text] <phrase> <replacewith>

Replaces the first occurrence of phrase with replacewith. If text is specified, the subtag is replaced with the new toreplace. If not, it replaces the message that will be sent from this tag.

Example Code:

I like {replace;to eat;eat;nom} cheese. {replace;cheese;ham}

Example Output:

I like to nom ham. ham

return

Arguments: [force]

Stops execution of the tag and returns what has been parsed. If force is true then it will also return from any tags calling this tag. force defaults to true

Example Code:

This will display. {return} This will not.

Example Output:

This will display.

reverse

Arguments: <text>

Reverses the order of text. If text is an array, the array will be reversed. If {get} is used with an array, this will modify the original array.

Example Code:

{reverse;palindrome}

Example Output:

emordnilap

rolecolor

Arguments: <role> [quiet]

Returns role's hex color code. If quiet is specified, if role can't be found it will simply return nothing.

Example Code:

The admin role color is: #{rolecolor;admin}.

Example Output:

The admin role ID is: #1b1b1b.

roleid

Arguments: <role> [quiet]

Returns role's ID. If quiet is specified, if role can't be found it will simply return nothing.

Example Code:

The admin role ID is: {roleid;admin}.

Example Output:

The admin role ID is: 123456789123456.

rolemembers

Arguments: <role> [quiet]

Returns an array of members in role. If quiet is specified, if role can't be found it will simply return nothing.

Example Code:

The admins are: {rolemembers;Admin}.

Example Output:

The admins are: ["11111111111111111","22222222222222222"].

rolename

Arguments: <role> [quiet]

Returns role's name. If quiet is specified, if role can't be found it will simply return nothing.

Example Code:

The admin role name is: {rolename;admin}.

Example Output:

The admin role name is: Administrator.

roles

Arguments: [user] [quiet]

Returns an array of roles on the current guild. If user is specified, get the roles that user has. If quiet is specified, if a user can't be found it will simply return nothing.

Example Code:

The roles on this guild are: {roles}.

Example Output:

The roles on this guild are: ["11111111111111111","22222222222222222"].

rolesize (inrole)

Arguments: <roleId>

Returns how many people have the roleId role.

Example Code:

There are {rolesize;11111111111111111} people in the role!

Example Output:

There are 5 people in the role!

rollback

Arguments: [variables...]

For optimization reasons, variables are not stored in the database immediately when you use {set}. Instead they are cached, and will be saved to the database when the tag finishes. If you have some variables that you dont want to be changed, you can use this to revert them back to their value at the start of the tag, or the most recent {commit}.
variables defaults to all values accessed up to this point.
{commit} is the counterpart to this.

Example Code:

{set;var;Hello!}
{commit}
{set;var;GoodBye!}
{rollback}
{get;var}

Example Output:

Hello!

round

Arguments: <number>

Rounds number to the nearest whole number.

Example Code:

{round;1.23}

Example Output:

1

rounddown (floor)

Arguments: <number>

Rounds number down.

Example Code:

{rounddown;1.23}

Example Output:

1

roundup (ceil)

Arguments: <number>

Rounds number up.

Example Code:

{roundup;1.23}

Example Output:

2

set

Arguments: <name> [value...]

Stores value under name. These variables are saved between sessions. You can use a character prefix to determine the scope of your variable.
Valid scopes are: _ (Server), @ (Author), * (Global), ~ (Temporary), none (Local).
For performance reasons, variables are not immediately stored to the database. See {commit} and {rollback}for more information, or use b!t docs variable or b!cc docs variable

Example Code:

{set;var1;This is local var1}
{set;~var2;This is temporary var2}
{set;var3;this;is;an;array}
{get;var1}
{get;~var2}
{get;var3}

Example Output:

This is local var1
This is temporary var2
{"v":["this","is","an","array"],"n":"var3"}

shuffle

Arguments: [array]

Shuffles the {args} the user provided, or the elements of array. If used with a variable this will modify the original array

Example Code:

{shuffle} {args;0} {args;1} {args;2}

Example Input:

one two three

Example Output:

three one two

space

Arguments: [count]

Will be replaced by count spaces (Default to 1).

Example Code:

Hello,{space;4}world!

Example Output:

Hello, world!

substring

Arguments: <text> <start> [end]

Returns all text from text between the start and end. end defaults to the length of text.

Example Code:

Hello {substring;world;2;3}!

Example Output:

Hello r!

subtagexists

Arguments: <subTag>

Checks to see if subTag exists.

Example Code:

{subtagexists;ban} {subtagexists;AllenKey}

Example Output:

true false

suppresslookup

Arguments: [value]

Sets whether error messages in the lookup system (query canceled, nothing found) should be suppressed. value must be a boolean, and defaults to true.

Example Code:

{suppresslookup}

switch

Arguments: <value> [<case> <then>...] [default]

Finds the case that matches value and returns the following then. If a case value is an array, it will be expanded and matching will be done against its elements. If there is no matching case and default is specified, default is returned. If not, it returns blank.

Example Code:

{switch;{args;0};
["yes","definitely"]; {//;Match "yes" OR "definitely"}
Correct!;
no;
Incorrect!;
That is not yes or no
}

Example Input:

yes

Example Output:

Correct!

throw

Arguments: [error]

Throws error.

Example Code:

{throw;Custom Error}

Example Output:

Custom Error

time

Arguments: [format] [time] [parseformat] [timezone]

Returns time formatted using format. format defaults to YYYY-MM-DDTHH:mm:ssZ. time defaults to the current time. See the moment documentation for more information.
If you provide time, you should also provide parseformat to ensure it is being interpreted correctly. See here for parsing documentation. See here for a list of timezone codes.

Example Code:

It's currently {time;YYYY/MM/DD HH:mm:ss}

Example Output:

It's currently 2016/01/01 01:00:00

trim

Arguments: <text>

Trims whitespace and newlines before and after text.

Example Code:

Hello {trim;{space;10}beautiful{space;10}} World

Example Output:

Hello beautiful World

upper

Arguments: <text>

Returns text as uppercase.

Example Code:

{upper;this will become uppercase}

Example Output:

THIS WILL BECOME UPPERCASE

uriencode

Arguments: <text>

Encodes text in URI format. Useful for constructing links.

Example Code:

{uriencode;Hello world!}

Example Output:

Hello%20world!

useravatar

Arguments: [user] [quiet]

Returns the avatar of user. user defaults to the user who executed the containing tag. If quiet is specified, if user can't be found it will simply return nothing.

Example Code:

Your avatar is {useravatar}

Example Output:

Your avatar is (avatar url)

usercreatedat

Arguments: [format] [user] [quiet]

Returns the date that user was created using format for the output, in UTC+0. user defaults to the user executing the containing tag. format defaults to YYYY-MM-DDTHH:mm:ssZ. See the moment documentation for more information. If quiet is specified, if user can't be found it will simply return nothing.

Example Code:

Your account was created on {usercreatedat;YYYY/MM/DD HH:mm:ss}

Example Output:

Your account was created on 2016/01/01 01:00:00.

userdiscrim

Arguments: [user] [quiet]

Returns user's discriminator. user defaults to defaults to the user who executed the containing tag. If quiet is specified, if user can't be found it will simply return nothing.

Example Code:

Your discrim is {userdiscrim}

Example Output:

Your discrim is 1234

usergame

Arguments: [user] [quiet]

Returns the game user is playing. If user isn't playing a game, returns the word nothing. user defaults to the user who executed the containing tag. If quiet is specified, if user can't be found it will simply return nothing.

Example Code:

You are playing {usergame}

Example Output:

You are playing with bbtag

usergametype

Arguments: [user] [quiet]

Returns how user is playing the game (playing, streaming). user defaults to the user who executed the containing tag. If quiet is specified, if user can't be found it will simply return nothing.

Example Code:

You are {usergametype} right now!

Example Output:

You are playing right now!

userhasrole (hasrole)

Arguments: <roleids> [user] [quiet]

Checks if a user has any of the provided roleids, and returns either true or false. Roleid can be an array of role ids, or a single role id. You can find a list of roles and their ids by doing b!roles. If user is provided, check that user, otherwise use the person who called this tag.If quiet is specified, if a user can't be found it will simply return false

Example Code:

You are a moderator: {userhasrole;moderator}

Example Output:

You are a moderator: false

userid

Arguments: [user] [quiet]

Returns user's ID. user defaults to the user who executed the containing tag. If quiet is specified, if user can't be found it will simply return nothing.

Example Code:

Your id is {userid}

Example Output:

Your id is 123456789123456

userisbot (userbot)

Arguments: [user] [quiet]

Returns whether a user is a bot. user defaults to the user who executed the containing tag. If quiet is specified, if user can't be found it will simply return nothing.

Example Code:

Are you a bot? {userisbot}

Example Output:

Are you a bot? false

userjoinedat

Arguments: [format] [user] [quiet]

Returns the date that user joined the current guild using format for the output, in UTC+0. user defaults to the user who executed the containing tag. format defaults to YYYY-MM-DDTHH:mm:ssZ. See the moment documentation for more information. If quiet is specified, if user can't be found it will simply return nothing.

Example Code:

Your account joined this guild on {usercreatedat;YYYY/MM/DD HH:mm:ss}

Example Output:

Your account joined this guild on 2016/01/01 01:00:00.

username

Arguments: [user] [quiet]

Returns user's name. user defaults to the user who executed the containing tag. If quiet is specified, if user can't be found it will simply return nothing.

Example Code:

Your username is {username}!

Example Output:

Your username is user!

usernick

Arguments: [user] [quiet]

Returns user's nickname. If it doesn't exist, returns their username instead. user defaults to the user who executed the containing tag. If quiet is specified, if user can't be found it will simply return nothing.

Example Code:

Your nick is {usernick}!

Example Output:

Your nick is Cool Dude 1337!

userstatus

Arguments: [user] [quiet]

Returns the status of user (online, idle, dnd, or offline). user defaults to the user who executed the containing tag. If quiet is specified, if user can't be found it will simply return nothing.

Example Code:

You are currently {userstatus}

Example Output:

You are currently online

usertimezone

Arguments: [user] [quiet]

Returns the set timezone code of the specified user. user defaults to the user who executed the containing tag.If quiet is specified, if user can't be found it will simply return nothing.If the user has no set timezone, the output will be UTC.

Example Code:

My timezone is {timezone}

Example Output:

My timezone is UTC

void

Arguments: [code]

Executes code but does not return the output from it. Useful for silent functionality

Example Code:

{void;This won't be output!}

webhook

Arguments: <id> <token> [content] [embed] [username] [avatarURL]

Executes a webhook. The embed must be provided in a raw JSON format, properly escaped for BBTag. A simple escaping utility can be accessed here. You can find an easy tool to test out embeds here. Please assign your webhook credentials to private variables! Do not leave them in your code.

Example Code:

{webhook;1111111111111111;t.OK-en;Hello!}

Example Output:

In the webhook channel: Hello!

while

Arguments: <value1> [<evaluator> <value2>] <code>

This will continuously execute code for as long as the condition returns true. The condition is as follows:
If evaluator and value2 are provided, value1 is evaluated against value2 using evaluator. If they are not provided, value1 is read as true or false. Valid evaluators are ==, !=, >=, >, <=, <, startswith, endswith, includes.

Example Code:

{set;~x;0}
{while;{get;~x};<=;10;{increment;~x},}.

Example Output:

1,2,3,4,5,6,7,8,9,10,11,

Array

Subtags designed specifically for arrays.

apply

Arguments: <subtag> [args...]

Executes subtag, using the args as parameters. If args is an array, it will get deconstructed to it's individual elements.

Example Code:

{apply;randint;[1,4]}

Example Output:

3

concat

Arguments: <arrays...>

Takes arrays and joins them together to form a single array.

Example Code:

{concat;["this", "is"];["an", "array"]}

Example Output:

["this","is","an","array"]

foreach

Arguments: <variable> <array> <code>

For every element in array, variable will be set and then code will be run.

Example Code:

{set;~array;apples;oranges;c#}
{foreach;~element;~array;I like {get;~element}{newline}}

Example Output:

I like apples
I like oranges
I like c#

isarray

Arguments: <text>

Determines whether text is a valid array.

Example Code:

{isarray;["array?"]} {isarray;array?}

Example Output:

true false

join

Arguments: <array> <text>

Joins the elements of array together with text as the separator.

Example Code:

{join;["this", "is", "an", "array"];!}

Example Output:

this!is!an!array

pop

Arguments: <array>

Returns the last element in array. If provided a variable, this will remove the last element from array as well.

Example Code:

{pop;["this", "is", "an", "array"]}

Example Output:

array

push

Arguments: <array> <values...>

Pushes values onto the end of array. If provided a variable, this will update the original variable. Otherwise, it will simply output the new array.

Example Code:

{push;["this", "is", "an"];array}

Example Output:

["this","is","an","array"]

regexmatch (match)

Arguments: <text> <regex>

Returns an array of everything in text that matches regex.

Example Code:

{regexmatch;I have $1 and 25 cents;/\d+/g}

Example Output:

["1", "25"]

shift

Arguments: <array>

Returns the first element in array. If used with a variable this will remove the first element from array as well.

Example Code:

{shift;["this", "is", "an", "array"]}

Example Output:

this

slice

Arguments: <array> <start> [end]

Grabs elements between the zero-indexed start and end points (inclusive) from array.

Example Code:

{slice;["this", "is", "an", "array"];1}

Example Output:

["is","an","array"]

sort

Arguments: <array> [descending]

Sorts the array in ascending order. If descending is provided, sorts in descending order. If provided a variable, will modify the original array.

Example Code:

{sort;[3, 2, 5, 1, 4]}

Example Output:

[1,2,3,4,5]

splice

Arguments: <array> <start> [deleteCount] [items...]

Removes deleteCount elements (defaults to 0) from array starting at start. Then, adds each item at that position in array. Returns the removed items. If used with a variable this will modify the original array

Example Code:

{set;~array;["this", "is", "an", "array"]} {splice;{get;~array};1;1;was} {get;~array}

Example Output:

["is"] {"v":["this","was","an","array"],"n":"~array"}

split

Arguments: <text> [splitter]

Splits text using splitter, and the returns an array.

Example Code:

{split;Hello! This is a sentence.;{space}}

Example Output:

["Hello!","This","is","a","sentence."]

Custom Command

Subtags that only work in custom commands.

ban

Arguments: <user> [daysToDelete] [reason] [timeToUnban] [noperms]

Bans user. This functions the same as the ban command. If the ban is successful, Success will be returned, unless a duration was provided in which case the duration in ms will be returnedIf noperms is provided, do not check if the command executor is actually able to ban people. Only provide this if you know what you're doing.

Example Code:

{ban;stupid cat;0;This is a test ban} @stupid cat was banned!

Example Output:

Success @stupid cat was banned!

dm

Arguments: <user> <[message] [embed]>

DMs user the given message and embed. At least one of message and embed must be provided. You may only send one DM per execution. Requires author to be staff, and the user to be on the current guild.
Please note that embed is the JSON for an embed object, don't put the {embed} subtag there, as nothing will show.

Example Code:

{dm;stupid cat;Hello;{embedbuild;title:You're cool}}

Example Output:

DM: Hello
Embed: You're cool

edit

Arguments: [channelId] <messageId> <[text] [embed]>

Edits messageId in channelId to say text or embed. Atleast one of text and embed is required. If channelId is not supplied, it defaults to the current channel.
Please note that embed is the JSON for an embed object, don't put the {embed} subtag there, as nothing will show.
Only messages created by the bot may be edited

Example Code:

A message got edited: {edit;111111111111111111;New content;{embedbuild;title:You're cool}}

Example Output:

(the message got edited idk how to do examples for this)

kick

Arguments: <user> [reason] [noperms]

Kicks user. This functions the same as the kick command. If the kick is successful, Success will be returned, otherwise the error will be given. If noperms is provided, do not check if the command executor is actually able to kick people. Only provide this if you know what you're doing.

Example Code:

{kick;stupid cat;because I can} @stupid cat was kicked!

Example Output:

Success @stupid cat was kicked!

modlog

Arguments: <action> <user> [mod] [reason] [color]

Creates a custom modlog entry for the given action and user. color can be a HTML color, hex, (r,g,b) or a valid color number. .

Example Code:

You did a bad! {modlog;Bad;{userid};;They did a bad;#ffffff}

Example Output:

You did a bad! (modlog entry)

pardon

Arguments: [user] [count] [reason]

Gives user count pardons with reason, and returns their new warning count. user defaults to the person running the tag and count defaults to 1

Example Code:

Be pardoned! {pardon}

Example Output:

Be pardoned! 0

roleadd (addrole)

Arguments: <role> [user] [quiet]

Gives user the chosen role, where role is a role ID or mention. You can find a list of roles and their ids by doing b!roles. Returns true if role was given, and false otherwise. If quiet is specified, if a user can't be found it will simply return false

Example Code:

Have a role! {roleadd;11111111111111111}

Example Output:

Have a role! true

rolecreate

Arguments: <name> [color] [permissions] [mentionable] [hoisted]

Creates a role with the given information. color can be a HTML color, hex, (r,g,b) or a valid color number. Provide permissions as a number, which can be calculated here hoisted is if the role should be displayed separately from other roles color defaults to #000000 (uncolored role), permissions defaults to 0, mentionable defaults to false, hoisted defaults to false. Returns the new role's ID.

Example Code:

{rolecreate;Super Cool Role!;ff0000;0;false;true}

Example Output:

11111111111111111

roledelete

Arguments: <role> [quiet]

Deletes role. If quiet is specified, if role can't be found it will return nothing

Example Code:

{roledelete;Super Cool Role!}

Example Output:

(rip no more super cool roles for anyone)

rolemention

Arguments: <role> [quiet]

Returns a mention of role. If quiet is specified, if role can't be found it will simply return nothing.

Example Code:

The admin role ID is: {roleid;admin}.

Example Output:

The admin role ID is: 123456789123456.

roleremove (removerole)

Arguments: <role> [user] [quiet]

Removes role from user, where role is a role ID or mention. You can find a list of roles and their ids by doing b!roles. Returns true if role was removed, and false otherwise.If quiet is specified, if a user can't be found it will simply return false

Example Code:

No more role! {roleremove;11111111111111111}

Example Output:

No more role! true

rolesetmentionable

Arguments: <role> [value] [quiet]

Sets whether role can be mentioned. value can be either true to set the role as mentionable, or anything else to set it to unmentionable. If value isn't provided, defaults to true. If quiet is specified, if role can't be found it will simply return nothing

Example Code:

The admin role is now mentionable. {rolesetmentionable;admin;true}

Example Output:

The admin role is now mentionable.

send

Arguments: <channel> <[message] [embed]>

Sends message and embed to channel, and returns the message ID. channel is either an ID or channel mention. At least one out of message and embed must be supplied.
Please note that embed is the JSON for an embed object, don't put the {embed} subtag there, as nothing will show

Example Code:

{send;#channel;Hello!;{embedbuild;title:You're cool}}

Example Output:

1111111111111111111
In #channel: Hello!
Embed: You're cool

timer

Arguments: <code> <duration>

Executes code after duration. Three timers are allowed per custom command, with no recursive timers.

Example Code:

{timer;Hello!;20s}

Example Output:

(after 20 seconds:) Hello!

unban

Arguments: <user> [reason] [noperms]

Unbans user with the given reason. This functions the same as the unban command. If noperms is provided, do not check if the command executor is actually able to ban people. Only provide this if you know what you're doing.

Example Code:

{unban;@user;0;This is a test unban}@user was unbanned!

Example Output:

@user was unbanned!

usermention

Arguments: [user] [quiet]

Mentions user. user defaults to the user who executed the containing tag. If quiet is specified, if user can't be found it will simply return nothing.

Example Code:

Hello, {usermention}!

Example Output:

Hello, @user!

usersetnick (setnick)

Arguments: <nick> [user]

Sets user's nickname to nick. Leave nick blank to reset their nickname.

Example Code:

{usersetnick;super cool nickname}

warn

Arguments: [user] [count] [reason]

Gives user the specified number of warnings with the given reason, and returns their new warning count. user defaults to the user who executed the containing tag. count defaults to 1.

Example Code:

Be warned! {warn}

Example Output:

Be warned! 1

warnings

Arguments: [user]

Gets the number of warnings user has. user defaults to the user who executed the containing tag.

Example Code:

You have {warnings} warning(s)!

Example Output:

You have 0 warning(s)!

Examples

Tags can be combined, nested, and used together to create powerful commands. Here are some examples of existing tags.

waifu
  • stupid cat#8160

    b!t uwaifu stupid cat

  • blargbot#0128
    BOT

    ❤ I'd rate stupid cat as 9.5/10 ❤

{if;
  >;
  {argslength};
  0;
  {set;
    waifuhash;
    {hash;
      {userid;
        {args}}
    }
  }
  {set;
    waifurating;
    {math;
      %;
      {if;
        <;
        {get;waifuhash};
        0;
        {math;*;{get;waifuhash};-1};
        {get;waifuhash}
      };
      100
    }
  }
  {set;
    waifumoji;
    {if;
      <=;
      {get;waifurating};
      60;
      💔;
      ❤
    }
  }
  {get;waifumoji} I'd rate {usernick;{args}} as {math;/;{get;waifurating};10}/10 {get;waifumoji};
  Calculate the waifu rating of any user. Use waifu if you want to use any word.
Usage: `uwaifu <name>`
sleepykitty
Here's your sleepy kitty, {username}! {randchoose; http://i.imgur.com/zuhDRDT.gif ;http://i.imgur.com/0Jouxni.gif ;http://i.imgur.com/xP4Twvo.gif ;http://i.imgur.com/EDBtvW4.gif ;http://i.imgur.com/Pr0ovhy.gif ;http://i.imgur.com/CNh2Jen.gif ;http://i.imgur.com/lYTc1f3.gif ;http://i.imgur.com/9125v7e.gif ;http://i.imgur.com/d1cGI9H.gif ;http://i.imgur.com/Jdxjdgm.gif ;http://i.imgur.com/0ixS2gi.gif ;http://i.imgur.com/p8soxvZ.gif ;http://i.imgur.com/bssgLxK.gif ;http://i.imgur.com/tLVte5N.gif ;http://i.imgur.com/PyvrGTI.gif ;http://i.imgur.com/Hfh4LQH.gif ;http://i.imgur.com/mDTWNSY.gif ;http://i.imgur.com/fc3BsdW.gif ;http://i.imgur.com/vTXqGdS.gif ;http://i.imgur.com/DzMOiZx.gif ;http://i.imgur.com/IWa6N2B.gif ;http://i.imgur.com/YxYpOHc.gif ;http://i.imgur.com/YwLHV2L.gif}
f
  • stupid cat#8160

    b!t f

  • blargbot#0128
    BOT

    stupid cat has paid their respects. Total respects given: 13

{fallback;0}{set;respects;{math;+;{get;respects};1}} **{usernick}** has paid their respects. Total respects given: **{get;respects}**