Default Variables

The following blocks will be present and accessable as defaults when running any tag.

Meta Variables

Meta variables reference meta attributes about the tag invocation.

Args Block

class TagScriptEngine.StringAdapter(string: str, *, escape: bool = False)[source]

The {args} block represents the arguments passed after the tag name when invoking a tag. If no parameter is passed, it returns all the text after the invocation name. If an index is passed, it will split the arguments into a list by the given splitter, and return the word at that index. The default splitter is a “ “.

Usage: {args([index]):[splitter]>}

Payload: splitter

Parameter: index

Examples:

In the following examples, assume the tag’s name is argstag and the message content is [p]argstag My dog is cute! Would you like to see a photo?.

{args}
# My dog is cute! Would you like to see a photo?

{args(1)}
# My

{args(2):!}
# Would you like to see a photo?

Uses Block

class TagScriptEngine.IntAdapter(integer: int)[source]

The {uses} block returns the number of times a tag has been used.

Usage: {uses}

Payload: None

Parameter: None

Examples:

{uses}
# 1

Discord Object Variables

These blocks reference Discord objects from the tag invocation context.

Author Block

class TagScriptEngine.MemberAdapter(base: TextChannel | DMChannel | User | Member | Guild | Role)[source]

The {author} block with no parameters returns the tag invoker’s full username and discriminator, but passing the attributes listed below to the block payload will return that attribute instead.

Aliases: user

Usage: {author([attribute])

Payload: None

Parameter: attribute, None

id

The author’s Discord ID.

name

The author’s username.

nick

The author’s nickname, if they have one, else their username.

avatar

A link to the author’s avatar, which can be used in embeds.

discriminator

The author’s discriminator.

created_at

The author’s account creation date.

timestamp

The author’s account creation date as a UTC timestamp.

joined_at

The date the author joined the server.

joinstamp

The author’s join date as a UTC timestamp.

mention

A formatted text that pings the author.

bot

Whether or not the author is a bot.

color

The author’s top role’s color as a hex code.

top_role

The author’s top role.

roleids

A list of the author’s role IDs, split by spaces.

boost

If the user has boosted, this will be the UTC timestamp of when they did, if not this will be empty.

timed_out

If the user is currently timed out, the datetime of when the timeout ends; otherwise False.

banner

The user’s banner url, if available. A banner is not delivered over the gateway, so the bare engine only sees it when the member was retrieved via an explicit REST fetch - otherwise this is empty for cached members. The Tags cog resolves it lazily (fetching only when a tag uses banner, with caching and a per-user cooldown), so there it is populated on demand.

Target Block

The {target} block follows the same usage and has the same attributes as the Author Block, but it resolves the target as follows:

  • the first user @mentioned in the tag invocation message, if any; otherwise

  • the first raw user ID in the tag’s arguments, as long as that ID belongs to a member of the current server (resolved from cache); otherwise

  • the tag author.

Only the first match is used in each case; any further mentions or IDs are ignored. An ID that is not a member of the server falls back to the tag author.

Usage: {target}

Aliases: {member}

Channel Block

class TagScriptEngine.ChannelAdapter(base: TextChannel | DMChannel | User | Member | Guild | Role)[source]

The {channel} block with no parameters returns the channel’s full name but passing the attributes listed below to the block payload will return that attribute instead.

Usage: {channel([attribute])

Payload: None

Parameter: attribute, None

id

The channel’s ID.

name

The channel’s name.

created_at

The channel’s creation date.

timestamp

The channel’s creation date as a UTC timestamp.

nsfw

Whether the channel is nsfw.

mention

A formatted text that pings the channel.

topic

The channel’s topic.

category_id

The category the channel is associated with. If no category channel, this will return empty.

jump_url

A link to the channel.

Server Block

class TagScriptEngine.GuildAdapter(base: TextChannel | DMChannel | User | Member | Guild | Role)[source]

The {server} block with no parameters returns the server’s name but passing the attributes listed below to the block payload will return that attribute instead.

Aliases: guild

Usage: {server([attribute])

Payload: None

Parameter: attribute, None

id

The server’s ID.

name

The server’s name.

icon

A link to the server’s icon, which can be used in embeds.

created_at

The server’s creation date.

timestamp

The server’s creation date as a UTC timestamp.

member_count

The server’s member count.

bots

The number of bots in the server.

humans

The number of humans in the server.

description

The server’s description if one is set, or “No description”.

random

A random member from the server.

vanity

If guild has a vanity, this returns the vanity else empty.

owner_id

The server owner’s id.

mfa

The server’s mfa level.

boosters

The server’s active booster count.

boost_level

The server’s current boost level/tier.

discovery_splash

A link to the server’s discovery splash.

invite_splash

A link to the server’s invite splash.

banner

A link to the server’s banner.

Bot Block

class TagScriptEngine.RedBotAdapter(base: Red, *, owner: bool = True)[source]

The {bot} block with no parameters returns the bot’s name & discriminator, but passing the attributes listed below to the block payload will return that attribute instead.

Usage: {bot([attribute])}

Payload: None

Parameter: attribute, None

id

The bot’s Discord ID.

name

The bot’s username.

discriminator

The bot’s discriminator.

nick

The bot’s global display name. This is not a per-server nickname: the bot user has no guild context here, so a server-specific nick is not available through this block.

created_at

The bot’s creation date.

timestamp

The bot’s creation date as a UTC timestamp.

mention

A formatted text that pings the bot.

avatar

A link to the bot’s avatar, which can be used in embeds.

verified

If the bot is verified or not.

shard_count(*)

The bot’s total shard count.

servers(*)

Total server/guild count of the bot.

channels(*)

Total number of channels visible to the bot.

visible_users(*)

Total number of users visible to the bot.

total_users(*)

The bot’s total user count.

unique_users(*)

The bot’s unique user count.

percentage_chunked(*)

Percentage of the bot’s members that are cached/chunked (rounded to two decimals); 0 when no member counts are available.

Attributes marked ``(*)`` are owner-only and return nothing for other users.

Warning

Attributes marked (*) are owner-only: they are only available when the tag is invoked by a bot owner, and return nothing for everyone else.