Adapter Module¶
-
class
TagScriptEngine.adapter.SafeObjectAdapter(base)[source]¶ Bases:
TagScriptEngine.interface.adapter.Adapter-
get_value(ctx: TagScriptEngine.verb.Verb) → str[source]¶ Processes the adapter’s actions for a given
Context.Subclasses must implement this.
- Parameters:
ctx (Context) – 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:
TagScriptEngine.interface.adapter.Adapter-
get_value(ctx: TagScriptEngine.verb.Verb) → str[source]¶ Processes the adapter’s actions for a given
Context.Subclasses must implement this.
- Parameters:
ctx (Context) – 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:
TagScriptEngine.interface.adapter.Adapter-
get_value(ctx: TagScriptEngine.verb.Verb) → str[source]¶ Processes the adapter’s actions for a given
Context.Subclasses must implement this.
- Parameters:
ctx (Context) – 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:
TagScriptEngine.interface.adapter.Adapter-
get_value(ctx: TagScriptEngine.verb.Verb) → str[source]¶ Processes the adapter’s actions for a given
Context.Subclasses must implement this.
- Parameters:
ctx (Context) – 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(base)[source]¶ Bases:
TagScriptEngine.interface.adapter.Adapter-
get_value(ctx: TagScriptEngine.verb.Verb) → str[source]¶ Processes the adapter’s actions for a given
Context.Subclasses must implement this.
- Parameters:
ctx (Context) – 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.MemberAdapter(base)[source]¶ Bases:
TagScriptEngine.adapter.discordadapters.AttributeAdapterThe
{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.
-
-
class
TagScriptEngine.adapter.ChannelAdapter(base)[source]¶ Bases:
TagScriptEngine.adapter.discordadapters.AttributeAdapterThe
{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.
-
-
class
TagScriptEngine.adapter.GuildAdapter(base)[source]¶ Bases:
TagScriptEngine.adapter.discordadapters.AttributeAdapterThe
{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.
-