Adapter Module

class bTagScript.adapter.SafeObjectAdapter(base)[source]

Bases: Adapter

For objects

get_value(ctx: Verb) str[source]

Get the value safely

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

Bases: Adapter

String adapter, allows blocks to be parsed, used basically only for variables

get_value(ctx: Verb) str[source]

Get the value given the verb

handle_ctx(ctx: Verb) str[source]

Transform any parsing data the block may have

return_value(string: str) str[source]

Return the value, escaped

class bTagScript.adapter.IntAdapter(integer: int)[source]

Bases: Adapter

IntAdapter, so far no use for this?

get_value(ctx: Verb) str[source]

Get the value of the int into string, not sure why this even exists

class bTagScript.adapter.FunctionAdapter(function_pointer: Callable[[], str])[source]

Bases: Adapter

Function adapter…

Would be cool to have functions in tagscript

get_value(ctx: Verb) str[source]

Run the function and get the value

class bTagScript.adapter.AttributeAdapter(base: Union[TextChannel, Member, Guild])[source]

Bases: Adapter

Base attribute adapter for discord.py objects

update_attributes() None[source]

Update attributes for the block

update_methods() None[source]

Update methods for the block

get_value(ctx: Verb) str[source]

Get the value for the adapter

class bTagScript.adapter.MemberAdapter(base: Union[TextChannel, Member, Guild])[source]

Bases: AttributeAdapter

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.

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.

boost

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

timed_out

If the user is timed out, this will be the the UTC timestamp of when they’ll be “untimed-out”, if not timed out, this will be empty.

banner

The users banner url

roleids

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

update_attributes() None[source]

Update the adapter with all it’s needed attributes

class bTagScript.adapter.ChannelAdapter(base: Union[TextChannel, Member, Guild])[source]

Bases: AttributeAdapter

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.

slowmode

The channel’s slowmode in seconds, 0 if disabled

update_attributes() None[source]

Update block attributes

class bTagScript.adapter.GuildAdapter(base: Union[TextChannel, Member, Guild])[source]

Bases: AttributeAdapter

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.

update_attributes() None[source]

Update block attributes

update_methods() None[source]

Update methods for the block

random_member() None[source]

Return a random member