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.

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

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! {

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.

//

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)

<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

[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)

<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)

<base64>

Converts the provided base64 to a UTF-8 string.

Example Code:

{base64decode;​RmFuY3kh}

Example Output:

Fancy!

base64encode (btoa)

<text>

Converts the provided text to base64.

Example Code:

{base64encode;​Fancy!}

Example Output:

RmFuY3kh

bool

<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

<code> [input]

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

Example Code:

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

Example Output:

Hello World!

capitalize

<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

<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

<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

<color> [outputFormat] [inputFormat]

Convert colors. Default outputFormat is hex. Default inputFormat is automatically calculated, but might be inaccurate.
It converts all ways between rgb, hsl, hsv, hwb, cmyk, ansi16, hex strings, and CSS keywords (will round to closest).

Example Code:

{color;​#4286f4;​RGB}

Example Output:

[66,​134,​244]

commit

[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!

debug

[text...]

Adds the specified text to the debug output. This output is only shown via tag debug, ccommand debug, tag test debug and ccommand test debug.The line number is also included in the debug entry

Example Code:

{debug;​current value;​{get;​~i}}

Example Output:

(in debug output)[10]current value 1

decrement

<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

[[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.

Limits for tags
- Maximum 11 uses
Limits for custom commands
- Maximum 11 uses
Limits for general autoresponses
- Maximum 2 uses
Limits for everything autoresponses
- Maximum 2 uses
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

<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)

<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

<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:

🍔 🍕 😩 🍴 😐

fallback

[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

file

<file> <filename>

Sets the output attachment to the provided file and filename. If file starts with buffer:, the following text will be parsed as base64 to a raw buffer - useful for uploading images.

Example Code:

{file;​Hello, world!;​readme.txt}

Example Output:

(a file labeled readme.txt containing "Hello, world!")

for

<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

Limits for tags
- Maximum 1500 loops
Limits for custom commands
- Maximum 1500 loops
Limits for general autoresponses
- Maximum 1000 loops
Limits for everything autoresponses
- Maximum 500 loops
Example Code:

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

Example Output:

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

function (func)

<name> <code>

Defines a function called name. Functions are called in the same way as subtags, however they are prefixed with func.. While inside the code block of a function, you may use the params, paramsarray and paramslength subtags to access the values passed to the function. These function identically to their args counterparts.


Please note that there is a recursion limit of 200 which is also shared by {exec}, {execcc} and {inject}.

Example Code:

{function;​test;​{paramsarray}} {func.test;​1;​2;​3;​4}

Example Output:

["1",​"2",​"3",​"4"]

get

<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"}

hash

<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.

htmldecode

<text>

Decodes html entities from text.

Example Code:

{htmldecode;​<​hello, world>​}

Example Output:

htmlencode

<text>

Encodes text with escaped html entities.

Example Code:

{htmlencode;​}

Example Output:

<​hello, world>

if

<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

<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

<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

length

<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.

lock

<mode> <key> <code>

Provides read/​write locking functionality for bbtag. This is a very advanced feature, so it is reccomended that you first read about the concept of locks.


In simple terms, a lock allows commands running at the same time to cooperate and wait for eachother to finish what they are doing before "releasing the lock" and letting other commands use that lock. This can be used to secure against data being edited by 2 things at the same time, which can cause inconsistencies.


There can be multiple read locks held at once or a single write lock. This means that if all your command is doing is reading some data then as long as nothing is writing to it, it will be allowed, otherwise the command will wait until it can aquire a lock.


mode must be either read or write.
key can be anything. This follows the same scoping rules as variables do.
code will be run once the lock is acquired

Example Code:

{/​/​;​in 2 command run in quick succession}
{lock;​write;​key;
{void;
{send;​{channelid};​Start}
{send;​{channelid};​Middle}
{send;​{channelid};​End}
}
}
This order is guaranteed always. Without a lock it isnt

Example Output:

Start
Middle
End
Start
Middle
End
This order is guaranteed always. Without a lock it isnt

logic

<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

<text>

Returns text as lowercase.

Example Code:

{lower;​THIS WILL BECOME LOWERCASE}

Example Output:

this will become lowercase

math

<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

<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

md5 (md5encode)

<text>

Converts the provided text to md5.

Example Code:

{md5;​Woosh whap phew!}

Example Output:

71d97a11f770a34d7f8cf1f1d8749d85

min

<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

[count]

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

Example Code:

Hello,​{newline}world!

Example Output:

Hello,
world!

numformat

<number> [roundTo] [decimal] [thousands]

Rounds number to roundTo digits. Also you can specify decimal and thousands delimitors. To skip roundTo or decimal leave them empty.

Example Code:

{numformat;​123456.789;​2}
{numformat;​123456.789;​-3}
{numformat;​123456.789;​;​;​,​}

Example Output:

123456.79
123000
123,​456.789

pad

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

<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

<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

<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

randchoose

<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

[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

<chars> <length>

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

Example Code:

{randstr;​abcdefghijklmnopqrstuvwxyz;​9}

Example Output:

kgzyqcvda

realpad

<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

[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. regex will only succeed to compile if it is deemed a safe regular expression (safe regexes do not run in exponential time for any input) and is less than 2000 characters long.

Example Code:

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

Example Output:

I likn ta cansumn chnnsn.

regexsplit

<text> <regex>

Splits the given text using the given regex as the split rule. regex will only succeed to compile if it is deemed a safe regular expression (safe regexes do not run in exponential time for any input) and is less than 2000 characters long.

Example Code:

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

Example Output:

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

regextest

<text> <regex>

Tests if the regex phrase matches the text, and returns a boolean (true/​false). regex will only succeed to compile if it is deemed a safe regular expression (safe regexes do not run in exponential time for any input) and is less than 2000 characters long.

Example Code:

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

Example Output:

true false

repeat (loop)

<text> <amount>

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

Limits for tags
- Maximum 1500 loops
Limits for custom commands
- Maximum 1500 loops
Limits for general autoresponses
- Maximum 1000 loops
Limits for everything autoresponses
- Maximum 500 loops
Example Code:

{repeat;​e;​10}

Example Output:

eeeeeeeeee

replace

[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

request

<url> [options] [data]

Performs an HTTP request to url, with provided options and data.
Only certain whitelisted domains can be used for url. See here for the list.


options is a JSON object with the following structure. It is recommended to use {jsonset} to create it.


{
"method": "GET|POST|PUT|PATCH|DELETE", /​/ defaults to GET
"headers": { "key": "value" }
}

If the method is GET and a JSON object is provided for data, it will be formatted as query strings.


The output is a JSON object with the following structure. It is recommended to use {jsonget} to navigate it.


{
"body": {}, /​/ the body of the request
"status": 200, /​/ the HTTP status code
"statusText": "OK", /​/ the human readable translation of the status code
"date": "Thu, 1 Jan 1970 00:00:00 GMT", /​/ the date sent in the headers
"contentType": "application/​json", /​/ the content type of the response
"url": "https:/​/​fancy.url/​here" /​/ the url that was requested
}
Example Code:

{jget;​{request;​https:/​/​blargbot.xyz/​output/​1111111111111111/​raw};​body}

Example Output:

Hello, world!

return

[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

<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

rollback

[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

<number>

Rounds number to the nearest whole number.

Example Code:

{round;​1.23}

Example Output:

1

rounddown (floor)

<number>

Rounds number down.

Example Code:

{rounddown;​1.23}

Example Output:

1

roundup (ceil)

<number>

Rounds number up.

Example Code:

{roundup;​1.23}

Example Output:

2

set

<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

[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

sleep

<duration>

Pauses the current tag for the specified amount of time. Maximum is 5 minutes

Limits for general autoresponses
Maximum Duration: 5000
Limits for everything autoresponses
Maximum Duration: 5000
Example Code:

{sleep;​10s}{send;​{channelid};​Hi!}

Example Output:

(After 10s) Hi!

space

[count]

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

Example Code:

Hello,​{space;​4}world!

Example Output:

Hello, world!

substring

<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!

switch

<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

[error]

Throws error.

Example Code:

{throw;​Custom Error}

Example Output:

Custom Error

time

[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

<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

<text>

Returns text as uppercase.

Example Code:

{upper;​this will become uppercase}

Example Output:

THIS WILL BECOME UPPERCASE

uridecode

<text>

Decodes text from URI format.

Example Code:

{uridecode;​Hello%20world}

Example Output:

Hello world!

uriencode

<text>

Encodes text in URI format. Useful for constructing links.

Example Code:

{uriencode;​Hello world!}

Example Output:

Hello%20world!

void

[code]

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

Example Code:

{void;​This won't be output!}

while

<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.

Limits for tags
- Maximum 1500 loops
Limits for custom commands
- Maximum 1500 loops
Limits for general autoresponses
- Maximum 1000 loops
Limits for everything autoresponses
- Maximum 500 loops
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

<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

<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"]

filter

<variable> <array> <code>

For every element in array, variable will be set and then code will be run. Returns a new array containing all the elements that returned the value true.


While inside the condition parameter, none of the following subtags may be used: dm, send, edit, delete, kick, ban, reactadd, reactremove, roleadd, rolecreate, roledelete, roleremove, rolesetmentionable, webhook, warn, modlog, pardon, embed, waitmessage, waitreact

Example Code:

{set;​~array;​apples;​apple juice;​grapefruit}
{filter;​~element;​~array;​{bool;​{get;​~element};​startswith;​apple}}

Example Output:

["apples",​"apple juice"]

foreach

<variable> <array> <code>

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

Limits for tags
- Maximum 3000 loops
Limits for custom commands
- Maximum 3000 loops
Limits for general autoresponses
- Maximum 2000 loops
Limits for everything autoresponses
- Maximum 1000 loops
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

<text>

Determines whether text is a valid array.

Example Code:

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

Example Output:

true false

join

<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

jsonset (jset)

<input> <path> <value> [create]

Using the input as a base, navigates the provided dot-notated path and assigns the value.input can be a JSON object, array, or string. If a string is provided, a variable with the same name will be used.If create is specified, will create/​convert any missing keys.

Example Code:

{jsonset;​;​path.to.key;​value;​create}

Example Output:

{"path":{"to":{"key":"value"}}}

pop

<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

<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)

<text> <regex>

Returns an array of everything in text that matches regex. regex will only succeed to compile if it is deemed a safe regular expression (safe regexes do not run in exponential time for any input) and is less than 2000 characters long.

Example Code:

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

Example Output:

["1", "25"]

shift

<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

<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

<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

<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

<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."]

Blargbot

Subtags that integrate with blargbots custom functions.

dump

<text>

Dumps the provided text to a blargbot output page. These expire after 7 days.

Limits for tags
- Maximum 5 uses
Limits for custom commands
- Maximum 5 uses
Limits for general autoresponses
- Maximum 5 uses
Limits for everything autoresponses
- Maximum 5 uses
Example Code:

{dump;​Hello, world!}

Example Output:

https:/​/​blargbot.xyz/​output/​1111111111111111

exec

<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

<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

flag

<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

<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

inject

<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

lang

This tag is deprecated. Avoid using it, as it will eventually become unsupported.

<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!.

modlog

<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. .

Limits for tags
- {modlog} is disabled
Limits for custom commands
- Author must be staff
Limits for general autoresponses
- Author must be staff
Limits for everything autoresponses
- Author must be staff
Example Code:

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

Example Output:

You did a bad! (modlog entry)

nsfw

[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!

output

[text]

Forces an early send of the default output message, using text as the text to show. If this is used then there will be no output sent once the tag finishes. Only 1 {output} may be used per tag/​cc. If a second {output} is used then the result of the first {output} will be returned instead.
The message id of the output that was sent will be returned.

Example Code:

{output;​Hello!}

Example Output:

Hello!

pardon

[user] [count] [reason]

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

Limits for tags
- {pardon} is disabled
Limits for custom commands
- Author must be staff
Limits for general autoresponses
- Author must be staff
Limits for everything autoresponses
- Author must be staff
Example Code:

Be pardoned! {pardon}

Example Output:

Be pardoned! 0

prefix

Gets the current guild's prefix.

Example Code:

Your prefix is {prefix}

Example Output:

Your prefix is b!

quiet

[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

reason

<reason>

Sets the reason for the next API call (ex. roleadd, roleremove, ban, etc.)

Limits for tags
- {reason} is disabled
Limits for custom commands
- Author must be staff
Limits for general autoresponses
- Author must be staff
Limits for everything autoresponses
- Author must be staff
Example Code:

{reason;​This will show up in the audit logs!}{roleadd;​111111111111}

subtagexists

<subTag>

Checks to see if subTag exists.

Example Code:

{subtagexists;​ban} {subtagexists;​AllenKey}

Example Output:

true false

suppresslookup

[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}

timer

<code> <duration>

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

Limits for tags
- {timer} is disabled
Limits for custom commands
- Author must be staff
- Maximum 3 uses
Limits for general autoresponses
- {timer} is disabled
Limits for everything autoresponses
- {timer} is disabled
Example Code:

{timer;​Hello!;​20s}

Example Output:

(after 20 seconds:) Hello!

waitmessage

[channels] [users] [condition] [timeout]

Pauses the command until one of the given users sends a message in any of the given channels. When a message is sent, condition will be run to determine if the message can be accepted. If no message has been accepted within timeout then the subtag returns Wait timed out, otherwise it returns an array containing the channel Id, then the message Id.


channels defaults to the current channel.
users defaults to the current user.
condition must return true or false and defaults to true
timeout is a number of seconds. This defaults to 60 and is limited to 300


While inside the condition parameter, none of the following subtags may be used: dm, send, edit, delete, kick, ban, reactadd, reactremove, roleadd, rolecreate, roledelete, roleremove, rolesetmentionable, webhook, warn, modlog, pardon, embed, waitmessage, waitreact
Also, the current message becomes the users message that is to be checked. This means that {channelid}, {messageid}, {userid} and all related subtags will change their values.

Limits for tags
- Maximum 5 uses
Limits for custom commands
- Maximum 10 uses
Limits for general autoresponses
- {waitmessage} is disabled
Limits for everything autoresponses
- {waitmessage} is disabled
Example Code:

{waitmessage;​{channelid};​{userid};​{bool;​{messagetext};​startswith;​Hi};​300}

Example Input:

Hi how you doing?

Example Output:

["111111111111111",​"2222222222222"]

waitreaction (waitreact)

<messages> [users] [reactions] [condition] [timeout]

Pauses the command until one of the given users adds any given reaction on any of the given messages. When a reaction is added, condition will be run to determine if the reaction can be accepted. If no reaction has been accepted within timeout then the subtag returns Wait timed out, otherwise it returns an array containing the channel Id, the message Id, the user id and the reaction, in that order.


users defaults to the current user.
reactions defaults to any reaction.
condition must return true or false and defaults to true
timeout is a number of seconds. This defaults to 60 and is limited to 300


While inside the condition parameter, none of the following subtags may be used: dm, send, edit, delete, kick, ban, reactadd, reactremove, roleadd, rolecreate, roledelete, roleremove, rolesetmentionable, webhook, warn, modlog, pardon, embed, waitmessage, waitreact
Also, the current message becomes the message the reaction was added to, and the user becomes the person who sent the message. This means that {channelid}, {messageid}, {userid} and all related subtags will change their values.
Finally, while inside the condition parameter, you can use the temporary subtag {reaction} to get the current reaction and the {reactuser} temporary subtag to get the user who reacted.

Limits for tags
- Maximum 20 uses
Limits for custom commands
- Maximum 20 uses
Limits for general autoresponses
- {waitreaction} is disabled
Limits for everything autoresponses
- {waitreaction} is disabled
Example Code:

{waitreaction;​{messageid};​{userid};​;​{if;​{reaction};​startswith;​<;​false;​true};​300}

Example Input:

(Reaction is added)

Example Output:

["111111111111111",​"2222222222222",​"3333333333333",​"🤔"]

warn

[user] [count] [reason]

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

Limits for tags
- {warn} is disabled
Limits for custom commands
- Author must be staff
Limits for general autoresponses
- Author must be staff
Limits for everything autoresponses
- Author must be staff
Example Code:

Be warned! {warn}

Example Output:

Be warned! 1

warnings

[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)!

API

Subtags that access the discord API to perform operations

ban

<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.

Limits for tags
- {ban} is disabled
Limits for custom commands
- Author must be staff
Limits for general autoresponses
- Author must be staff
Limits for everything autoresponses
- Author must be staff
Example Code:

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

Example Output:

Success @stupid cat was banned!

channelcategories (categories)

Returns an array of category IDs on the current guild.

Example Code:

This guild has {length;​{categories}} categories.

Example Output:

This guild has 7 categories.

channelcategory (category)

[channelid] [quiet]

Returns the category id of the given channel. If no channelid is given, the current channels category id will be returned.

Example Code:

This channel's category is "{category}"

Example Output:

This channel's category is "111111111111111"

channelid (categoryid)

[channelname] [quiet]

Returns the ID of the given channelname. If no channelname is given, it uses the current channel.

Example Code:

This channel's id is {channelid}

Example Output:

This channel's id is 1234567890123456

channeliscategory (iscategory)

<channelId> [quiet]

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

Example Code:

{if;​{iscategory,​123456789};​yup;​nope}

Example Output:

nope

channelisnsfw (isnsfw)

[channelId] [quiet]

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

channelistext (istext)

[channelId] [quiet]

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

Example Code:

{if;​{istext,​123456789};​yup;​nope}

Example Output:

nope

channelisvoice (isvoice)

[channelId] [quiet]

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

Example Code:

{if;​{istext,​123456789};​yup;​nope}

Example Output:

nope

channelname (categoryname)

[channelid] [quiet]

Returns the name of the given channel. If no channelid is given, the current channels name will be returned.

Example Code:

This channel's name is {channelname}

Example Output:

This channel's name is test-channel

channelpos (categorypos)

[channelid] [quiet]

Returns the position of the current channel. If no channelid is given, the current channels position will be returned.
The position is the index per channel type (text, voice or category) in the channel list.

Example Code:

This channel is in position {channelpos}

Example Output:

This channel is in position 1

channels

[categoryid] [quiet]

Returns an array of channel IDs on the current guild or within a given category.

Example Code:

This guild has {length;​{channels}} channels.

Example Output:

This guild has 23 channels.

channeltype

[channelid] [quiet]

Returns the type of a given channel. If no channelid is given, the current channels type will be returned.
Possible results: text, dm, voice, group-dm, category

Example Code:

This channel is {channeltype} channel

Example Output:

This channel is text channel

dm

<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.

Limits for tags
- {dm} is disabled
Limits for custom commands
- Author must be staff
- Maximum 1 uses
Limits for general autoresponses
- Author must be staff
- Maximum 1 uses
Limits for everything autoresponses
- Author must be staff
- Maximum 1 uses
Example Code:

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

Example Output:

DM: Hello
Embed: You're cool

edit

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

Edits messageId in channelId to say text or embed. Atleast one of text and embed is required. To delete the message text or the embed, enter _deleteIf 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

Limits for tags
- Maximum 10 uses
Limits for custom commands
- Maximum 10 uses
Limits for general autoresponses
- Maximum 1 uses
Limits for everything autoresponses
- Maximum 1 uses
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)

emojis

[roleid]

Returns an array of emoji IDs of the current guild.If roleid is specified, returns all the emojis whitelisted for the provided role.
Please note that Discord will remove all the emojis from a message which contains an emoji that blargbot can't use. For example, blargbot can't use a role-restricted emoji if it doesn't have the role. Learn more here.

Example Code:

This guild has {length;​{emojis}} emojis.

Example Output:

This guild has 23 emojis.

guildbans

Returns an array of banned users on the current guild.

Limits for tags
- {guildbans} is disabled
Limits for custom commands
- Author must be staff
Limits for general autoresponses
- Author must be staff
Limits for everything autoresponses
- Author must be staff
Example Code:

This guild has {length;​{guildbans}} banned users.

Example Output:

This guild has 123 banned users.

guildcreatedat

[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

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.

isstaff (ismod)

[user] [quiet]

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

Example Code:

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

Example Output:

You are a staff member!

json (j)

<input>

Defines a raw JSON object without using subtags.

Example Code:

{json;​{
"key": "value"
}}

Example Output:

{
"key": "value"
}

jsonget (jget)

<input> <path>

Navigates the path of a JSON object. Works with arrays too!
input can be a JSON object, array, or string. If a string is provided, a variable with the same name will be used.
path is a dot-noted series of properties.

Example Code:

{jsonget;​{j;​{
"array": [
"zero",
{ "value": "one" },
"two"
]
}};​array.1.value}

Example Output:

one

jsonstringify (jstringify)

<input> [indent]

Pretty-prints the provided JSON input with the provided indent, defaulting to 4.

Example Code:

{jsonstringify;​["one",​"two",​"three"]}

Example Output:

[
"one",
"two",
"three"
]

kick

<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.

Limits for tags
- {kick} is disabled
Limits for custom commands
- Author must be staff
Limits for general autoresponses
- Author must be staff
Limits for everything autoresponses
- Author must be staff
Example Code:

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

Example Output:

Success @stupid cat was kicked!

messageattachments (attachments)

[[channel] <messageid>]

Returns the array of attachment that a message contains in the given channel.
channel defaults to the current channel
messageid defaults to the executing message id

Example Code:

You sent the attachments "{messageattachments}"

Example Output:

You sent the attachments "["https:/​/​cdn.discordapp.com/​attachments/​1111111111111/​111111111111111/​thisisntreal.png"]"

messageedittime

[[channel] <messageid>] [format]

Returns the edit time of the given message in the given channel using the given format.
channel defaults to the current channel
messageid defaults to the executing message id
format defaults to x

Example Code:

That was edited at "{messageedittime;​DD/​MM/​YYYY HH:mm:ss}"

Example Output:

That was sent at "10/​06/​2018 10:07:44"

messageembeds

[[channel] <messageid>]

Returns the array of embeds on the given message in the given channel.
channel defaults to the current channel
messageid defaults to the executing message id

Example Code:

You sent an embed that looked like "{messageembed}"

Example Output:

You sent an embed that looked like "[{"title":"Hello!"}]"

messageid

Returns the ID of the invoking message.

Example Code:

The message id was {messageid}

Example Output:

The message id was 111111111111111111

messagesender (sender)

[[channel] <messageid>]

Returns the sender id of the given message in the given channel.
channel defaults to the current channel
messageid defaults to the executing message id

Example Code:

That was sent by "{sender}"

Example Output:

That was sent by "11111111111111111"

messagetext (text)

[[channel] <messageid>]

Returns the text of the given message in the given channel.
channel defaults to the current channel
messageid defaults to the executing message id

Example Code:

You sent "{messagetext}"

Example Output:

You sent "Spooky message"

messagetime (timestamp)

[[channel] <messageid>] [format]

Returns the send time of the given message in the given channel using the given format.
channel defaults to the current channel
messageid defaults to the executing message id
format defaults to x

Example Code:

That was sent at "{messagetime;​DD/​MM/​YYYY HH:mm:ss}"

Example Output:

That was sent at "10/​06/​2018 10:07:44"

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.

reactadd (addreact)

[[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)

[[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)

[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)

reactremoveall (removereactall)

[channelId] <messageId>

Removes all reactions from messageId.
channelId defaults to the current channel.

Example Code:

{reactremoveall;​12345678901234;​:thinking:}

Example Output:

(removed all the reactions)

roleadd (addrole)

<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

Limits for tags
- {roleadd} is disabled
Limits for custom commands
- Author must be staff
Limits for general autoresponses
- Author must be staff
Limits for everything autoresponses
- Author must be staff
Example Code:

Have a role! {roleadd;​11111111111111111}

Example Output:

Have a role! true

rolecolor

<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.

rolecreate

<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.

Limits for tags
- {rolecreate} is disabled
Limits for custom commands
- Author must be staff
Limits for general autoresponses
- Author must be staff
Limits for everything autoresponses
- Author must be staff
Example Code:

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

Example Output:

11111111111111111

roledelete

<role> [quiet]

Deletes role. If quiet is specified, if role can't be found it will return nothing.
Warning: this subtag is able to delete roles managed by integrations.

Limits for tags
- {roledelete} is disabled
Limits for custom commands
- Author must be staff
Limits for general autoresponses
- Author must be staff
Limits for everything autoresponses
- Author must be staff
Example Code:

{roledelete;​Super Cool Role!}

Example Output:

(rip no more super cool roles for anyone)

roleid

<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

<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"].

rolemention

<role> [quiet]

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

Limits for tags
- {rolemention} is disabled
Limits for custom commands
- Author must be staff
Limits for general autoresponses
- Author must be staff
Limits for everything autoresponses
- Author must be staff
Example Code:

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

Example Output:

The admin role ID is: 123456789123456.

rolename

<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.

roleremove (removerole)

<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

Limits for tags
- {roleremove} is disabled
Limits for custom commands
- Author must be staff
Limits for general autoresponses
- Author must be staff
Limits for everything autoresponses
- Author must be staff
Example Code:

No more role! {roleremove;​11111111111111111}

Example Output:

No more role! true

roles

[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"].

rolesetmentionable

<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

Limits for tags
- {rolesetmentionable} is disabled
Limits for custom commands
- Author must be staff
Limits for general autoresponses
- Author must be staff
Limits for everything autoresponses
- Author must be staff
Example Code:

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

Example Output:

The admin role is now mentionable.

rolesize (inrole)

<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!

send

<channel> <[message] [embed]> [file] [filename]

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.
If file is provided, filename will default to file.txt.
Please note that embed is the JSON for an embed object, don't put the {embed} subtag there, as nothing will show

Limits for tags
- {send} is disabled
Limits for custom commands
- Author must be staff
- Maximum 10 uses
Limits for general autoresponses
- Author must be staff
- Maximum 1 uses
Limits for everything autoresponses
- Author must be staff
- Maximum 1 uses
Example Code:

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

Example Output:

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

slowmode

[channel] [time]

Enables slowmode for the specified channel. time is the amount of seconds required between messages, with a maximum of 120. channel is the channel to modify, defaulting to the current one.

Limits for tags
- {slowmode} is disabled
Limits for custom commands
- Author must be staff
Limits for general autoresponses
- Author must be staff
Limits for everything autoresponses
- Author must be staff
Example Code:

{slowmode;​5}

Example Output:

(slowmode is enabled at a rate of 1 message per 5 seconds)

unban

<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.

Limits for tags
- {unban} is disabled
Limits for custom commands
- Author must be staff
Limits for general autoresponses
- Author must be staff
Limits for everything autoresponses
- Author must be staff
Example Code:

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

Example Output:

@user was unbanned!

useravatar

[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

[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

[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

[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

[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)

<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

[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)

[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

[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.

usermention

[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!

username

[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

[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!

userroles

[user] [quiet]

Returns user's roles as an array. 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 roles are {userroles}!

Example Output:

Your roles are ["1111111111111111",​"2222222222222222"]!

usersetnick (setnick)

<nick> [user]

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

Limits for tags
- {usersetnick} is disabled
Limits for custom commands
- Author must be staff
Limits for general autoresponses
- Author must be staff
Limits for everything autoresponses
- Author must be staff
Example Code:

{usersetnick;​super cool nickname}

userstatus

[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

[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

webhook

<id> <token> [content] [embed] [username] [avatarURL] [file] [filename]

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!

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}**