Adapter Module
- class TagScriptEngine.adapter.SafeObjectAdapter(base)[source]
Bases:
Adapter- get_value(ctx: Verb) str[source]
Processes the adapter’s actions for a given
Context.Subclasses must implement this.
- Parameters:
ctx (Verb) – The context object containing the TagScript
Verb.- Returns:
The adapters’s processed value.
- Return type:
Optional[str]
- Raises:
NotImplementedError – The subclass did not implement this required method.
- class TagScriptEngine.adapter.StringAdapter(string: str, *, escape: bool = False)[source]
Bases:
Adapter- get_value(ctx: Verb) str[source]
Processes the adapter’s actions for a given
Context.Subclasses must implement this.
- Parameters:
ctx (Verb) – The context object containing the TagScript
Verb.- Returns:
The adapters’s processed value.
- Return type:
Optional[str]
- Raises:
NotImplementedError – The subclass did not implement this required method.
- class TagScriptEngine.adapter.IntAdapter(integer: int)[source]
Bases:
Adapter- get_value(ctx: Verb) str[source]
Processes the adapter’s actions for a given
Context.Subclasses must implement this.
- Parameters:
ctx (Verb) – The context object containing the TagScript
Verb.- Returns:
The adapters’s processed value.
- Return type:
Optional[str]
- Raises:
NotImplementedError – The subclass did not implement this required method.
- class TagScriptEngine.adapter.FunctionAdapter(function_pointer: Callable[[], str])[source]
Bases:
Adapter- get_value(ctx: Verb) str[source]
Processes the adapter’s actions for a given
Context.Subclasses must implement this.
- Parameters:
ctx (Verb) – The context object containing the TagScript
Verb.- Returns:
The adapters’s processed value.
- Return type:
Optional[str]
- Raises:
NotImplementedError – The subclass did not implement this required method.
- class TagScriptEngine.adapter.AttributeAdapter(**kwargs: ~typing.~_P)[source]
Bases:
AdapterDeprecated since version 3.2.0: AttributeAdapter has been deprecated and will be removed in favor of
TagScriptEngine.adapter.discordadpaters.DiscordAttributeAdapteror consider usingTagScriptEngine.interface.adapter.SimpleAdapterinstead.- get_value(ctx: Verb) str[source]
Processes the adapter’s actions for a given
Context.Subclasses must implement this.
- Parameters:
ctx (Verb) – The context object containing the TagScript
Verb.- Returns:
The adapters’s processed value.
- Return type:
Optional[str]
- Raises:
NotImplementedError – The subclass did not implement this required method.
- class TagScriptEngine.adapter.DiscordAttributeAdapter(base: TextChannel | DMChannel | User | Member | Guild | Role)[source]
Bases:
SimpleAdapter[TextChannel|DMChannel|User|Member|Guild|Role]Added in version 3.2.0.
- get_value(ctx: Verb) str[source]
Processes the adapter’s actions for a given
Context.Subclasses must implement this.
- Parameters:
ctx (Verb) – The context object containing the TagScript
Verb.- Returns:
The adapters’s processed value.
- Return type:
Optional[str]
- Raises:
NotImplementedError – The subclass did not implement this required method.
- class TagScriptEngine.adapter.UserAdapter(base: TextChannel | DMChannel | User | Member | Guild | Role)[source]
Bases:
DiscordAttributeAdapterThe
{user}block with no parameters returns the user’s full username, but passing the attributes listed below to the block payload will return that attribute instead.Usage:
{user([attribute])}Payload: None
Parameter: attribute, None
- id
The user’s Discord ID.
- name
The user’s username.
- nick
The user’s nickname, if they have one, else their username.
- avatar
A link to the user’s avatar, which can be used in embeds.
- created_at
The user’s account creation date.
- timestamp
The user’s account creation date as UTC timestamp.
- mention
A formatted text that ping’s the user.
- bot
Wheather or not the user is a bot.
- accent_color
The user’s accent color if banner is not present.
- avatar_decoration
A link to the user’s avatar decoration.
- .. versionadded:: 3.2.0
- class TagScriptEngine.adapter.MemberAdapter(base: TextChannel | DMChannel | User | Member | Guild | Role)[source]
Bases:
DiscordAttributeAdapterThe
{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:
userUsage:
{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 timed out, this will be the UTC timestamp of when they’ll be untimed-out, if not timed out this will be empty.
- banner
The users banner url
- class TagScriptEngine.adapter.DMChannelAdapter(base: TextChannel | DMChannel | User | Member | Guild | Role)[source]
Bases:
DiscordAttributeAdapterThe
{channel}block with no parameters returns the channel’s full name but passing the attributes listed below to the block payload will return the 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.
- jump_url
A link to the channel.
- .. versionadded:: 3.2.0
- class TagScriptEngine.adapter.ChannelAdapter(base: TextChannel | DMChannel | User | Member | Guild | Role)[source]
Bases:
DiscordAttributeAdapterThe
{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.
- .. versionchanged:: 3.2.0
Added
jump_urlas a parameter.
- class TagScriptEngine.adapter.GuildAdapter(base: TextChannel | DMChannel | User | Member | Guild | Role)[source]
Bases:
DiscordAttributeAdapterThe
{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:
guildUsage:
{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.
- .. versionchanged:: 3.2.0
Added
mfa,boosters,boost_level,discovery_splash,invite_splash&banner.
- class TagScriptEngine.adapter.RoleAdapter(base: TextChannel | DMChannel | User | Member | Guild | Role)[source]
Bases:
DiscordAttributeAdapterThe
{role}block with no parameters returns the role’s full name but passing the attributes listed below to the block payload will return that attribute instead.Usage:
{role([attribute])}Payload: None
Parameter: attribute, None
- id
The role’s ID.
- name
The role’s name.
- created_at
The role’s creation date.
- timestamp
The role’s creation date as a UTC timestamp.
- color
The role’s color.
- display_icon
The role’s icon.
- hoist
Wheather the role is hoisted or not.
- managed
Wheather the role is managed or not.
- mention
A formatted text that pings the role.
- position
The role’s position.
- .. versionadded:: 3.2.0
- class TagScriptEngine.adapter.DiscordObjectAdapter(base: Object)[source]
Bases:
AdapterThe
{object}block with no parameters returs the discord object’s ID, but passing the attributes listed below to the block payload will return that attribute instead.Usage:
{object([attribute])}Payload: None
Parameter: attribute, None
- id
The object’s Discord ID.
- created_at
The object’s creation date.
- timestamp
The object’s creation date as a UTC timestamp.
- .. versionadded:: 3.2.0
- get_value(ctx: Verb) str[source]
Processes the adapter’s actions for a given
Context.Subclasses must implement this.
- Parameters:
ctx (Verb) – The context object containing the TagScript
Verb.- Returns:
The adapters’s processed value.
- Return type:
Optional[str]
- Raises:
NotImplementedError – The subclass did not implement this required method.
- class TagScriptEngine.adapter.RedCommandAdapter(base: redbot.core.commands.Command, *, signature: str | None = None)[source]
Bases:
SimpleAdapter[Command]- get_value(ctx: Verb) str[source]
Processes the adapter’s actions for a given
Context.Subclasses must implement this.
- Parameters:
ctx (Verb) – The context object containing the TagScript
Verb.- Returns:
The adapters’s processed value.
- Return type:
Optional[str]
- Raises:
NotImplementedError – The subclass did not implement this required method.
- class TagScriptEngine.adapter.RedBotAdapter(base: redbot.core.bot.Red, *, owner: bool = True)[source]
Bases:
SimpleAdapter[Red]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 nickname, if they have one, else their username.
- 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.
- 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 chunked guilds the bot has.
- .. warning::
Attributes denoting
(*)can only be used by the bot owner.
- get_value(ctx: Verb) str[source]
Processes the adapter’s actions for a given
Context.Subclasses must implement this.
- Parameters:
ctx (Verb) – The context object containing the TagScript
Verb.- Returns:
The adapters’s processed value.
- Return type:
Optional[str]
- Raises:
NotImplementedError – The subclass did not implement this required method.