forms.reactions

Module Contents

Classes

ReactionForm

The Reaction input object.

ReactionMenu

class forms.reactions.ReactionForm(message: discord.Message, bot: Union[discord.Client, commands.Bot], user: Union[discord.Member, discord.User] = None)

Bases: object

The Reaction input object.

Parameters
  • message (discord.Message) – The message of the reaction form object.

  • bot (typing.Union[discord.Client, discord.ext.commands.Bot]) – The bot being used for the form.

  • user (typing.Union[discord.Member, discord.User]) – The member or user who should be able to use the form. If none, the form will be open to anyone.

set_timeout(self, timeout: int) → None
add_reaction(self, reaction: discord.Emoji, result) → dict

Adds a question to the form.

Returns the full list of questions the form has, including the newly added one. The questions are held in dictionaries containing the question and optionally type keys. The question key contains the question as a string, and the type key contains the input validation (if any is specified)

async start(self) → Any

Starts the reaction form on the given message.

Returns

Whatever the given reaction was set to return.

Return type

Any

class forms.reactions.ReactionMenu(ctx: discord.ext.commands.Context, embeds: List[discord.Embed])

Bases: object

set_timeout(self, timeout: int)
remove_reactions(self, bool: bool = True)

Sets whether the bot should remove reactions or not. Useful if the bot doesn’t have Manage Messages

Parameters

choice (bool, optional) – Whether to remove reactions or not., by default True

addemoji(self, emoji: str, page: int) → bool

Adds an emoji/page mapping to your menu.

Parameters
  • emoji (str) – The emoji to be used as a string. Custom emoji are supported.

  • page (int) – The page to be mapped. Uses normal indexing (e.g. 1 is the first page)

Returns

The result of the emoji being added. False means an error occurred (most likely you tried to add an emoji that was already set) and True means that everything was successful.

Return type

bool

async start(self, channel=None)

Starts the menu in the given channel.

Parameters

channel (discord.TextChannel, optional) – The channel to send the menu to. If none is specified, it uses the context’s channel object.

Returns

Return type

None

Raises

TypeError – If channel isn’t specified and ctx wasn’t set on initialization, the form cannot continue.

exception forms.reactions.InvalidColor

Bases: Exception

Common base class for all non-exit exceptions.