Code Reference

Dialog

class disputils.abc.Dialog(*args, **kwargs)

Abstract base class defining a general embed dialog interaction.

display(text: str = None, embed: discord.embeds.Embed = None)

This will edit the dialog message.

Parameters:
  • text – The new text.
  • embed – The new embed.
Return type:

None

quit(text: str = None)

Quit the dialog.

Parameters:text (str, optional) – message text to display when dialog is closed
Return type:None
update(text: str, color: hex = None, hide_author: bool = False)

This will update the dialog embed.

Parameters:
  • text – The new text.
  • color – The new embed color.
  • hide_author – True if you want to hide the embed author (default: False).
Return type:

None

MultipleChoice

class disputils.MultipleChoice(client: discord.client.Client, options: List[str], title: str, description: str = '', **kwargs)

Generate and manage a reaction controlled rich embed multiple choice poll in Discord.

Parameters:
  • title (str) – Embed title.
  • description (str) – Embed description.
  • options (list[str]) – Options to choose from. Each option is going to be a separate embed field.
choice

The option that the user chose.

embed

The generated embed.

run(users: Union[discord.user.User, List[discord.user.User]] = None, channel: discord.channel.TextChannel = None, **kwargs) → Tuple[Optional[str], discord.message.Message]

Run the multiple choice dialog.

Parameters:
  • users (list[discord.User]) – Users that can use the reactions (default: None). If this is None: Any user can interact.
  • channel (discord.TextChannel, optional) – The channel to send the message to.
  • kwargs
    • message discord.Message
    • timeout int (seconds, default: 60),
    • closable bool (default: True)
    • text str: Text to appear in the message.
    • timeout_msg str: Text to appear when dialog times out.
    • quit_msg str: Text to appear when user quits the dialog.
Returns:

selected option and used discord.Message

Return type:

tuple[str, discord.Message]


class disputils.BotMultipleChoice(ctx: discord.ext.commands.context.Context, options: list, title: str, description: str = '', **kwargs)

Same as MultipleChoice, except for the discord.py commands extension.

run(users: Union[discord.user.User, List[discord.user.User]] = None, channel: discord.channel.TextChannel = None, **kwargs) → Tuple[Optional[str], discord.message.Message]

Run the multiple choice dialog.

Parameters:
  • users (list[discord.User]) – Users that can use the reactions (default: None). If this is None: Any user can interact.
  • channel (discord.TextChannel, optional) – The channel to send the message to.
  • kwargs
    • message discord.Message
    • timeout int (seconds, default: 60),
    • closable bool (default: True)
    • text str: Text to appear in the message.
    • timeout_msg str: Text to appear when dialog times out.
    • quit_msg str: Text to appear when user quits the dialog.
Returns:

selected option and used discord.Message

Return type:

tuple[str, discord.Message]

Confirmation

class disputils.Confirmation(client: discord.client.Client, color: hex = 0, message: discord.message.Message = None)

Represents a message to let the user confirm a specific action.

confirm(text: str, user: discord.user.User, channel: discord.channel.TextChannel = None, hide_author: bool = False, timeout: int = 20) → bool

Run the confirmation.

Parameters:
  • text (str) – The confirmation text.
  • user (discord.User) – The user who has to confirm.
  • channel (discord.TextChannel, optional) – The channel the message will be sent to. Must only be specified if self.message is None.
  • hide_author (bool, optional) – Whether or not the user should be set as embed author.
  • timeout (int) – Seconds to wait until stopping to listen for user interaction.
Returns:

True when it’s been confirmed, otherwise False. Will return None when a timeout occurs.

Return type:

bool, optional

confirmed

Whether the user has confirmed the action.


class disputils.BotConfirmation(ctx: discord.ext.commands.context.Context, color: hex = 0, message: discord.message.Message = None)
confirm(text: str, user: discord.user.User = None, channel: discord.channel.TextChannel = None, hide_author: bool = False, timeout: int = 20) → bool

Run the confirmation.

Parameters:
  • text (str) – The confirmation text.
  • user (discord.User) – The user who has to confirm.
  • channel (discord.TextChannel, optional) – The channel the message will be sent to. Must only be specified if self.message is None.
  • hide_author (bool, optional) – Whether or not the user should be set as embed author.
  • timeout (int) – Seconds to wait until stopping to listen for user interaction.
Returns:

True when it’s been confirmed, otherwise False. Will return None when a timeout occurs.

Return type:

bool, optional