Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import discord
from discord import Message, Client, TextChannel, User
from discord.ext.commands import Context
import asyncio
from typing import Tuple, List, Optional
from .abc import Dialog
class MultipleChoice(Dialog):
def __init__(self, client: Client, options: list, title: str, description: str = "", **kwargs):
super().__init__(**kwargs)
self._client: Client = client
self.options: List[str] = options
self.title: str = title
self.description: str = description
self.message: Optional[Message] = None
self._parse_kwargs(**kwargs)
self._embed: Optional[discord.Embed] = None
self._emojis: List[str] = []
self.close_emoji = '❌'
import discord
from discord.ext import commands
import asyncio
from .abc import Dialog
from typing import Optional
class Confirmation(Dialog):
""" Represents a message to let the user confirm a specific action. """
def __init__(self, client: discord.Client, color: hex = 0x000000, message: discord.Message = None):
super().__init__(color=color)
self._client = client
self.color = color
self.emojis = {"✅": True, "❌": False}
self._confirmed = None
self.message = message
self._embed: Optional[discord.Embed] = None
@property
def confirmed(self) -> bool:
""" Whether the user has confirmed the action. """
import discord
from discord.ext import commands
import asyncio
from copy import deepcopy
from typing import List
from .abc import Dialog
class EmbedPaginator(Dialog):
""" Represents an interactive menu containing multiple embeds. """
def __init__(self, client: discord.Client, pages: [discord.Embed], message: discord.Message = None):
"""
Initialize a new EmbedPaginator.
:param client: The :class:`discord.Client` to use.
:param pages: A list of :class:`discord.Embed` to paginate through.
:param message: An optional :class:`discord.Message` to edit. Otherwise a new message will be sent.
"""
super().__init__()
self._client = client
self.pages = pages
self.message = message