How to use the disputils.confirmation.Confirmation function in disputils

To help you get started, we’ve selected a few disputils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github LiBa001 / disputils / disputils / confirmation.py View on Github external
check=lambda r, u: (r.message.id == msg.id) and (u.id == user.id) and (r.emoji in self.emojis),
                timeout=20
            )
        except asyncio.TimeoutError:
            self._confirmed = None
            return
        finally:
            await msg.clear_reactions()

        confirmed = self.emojis[reaction.emoji]

        self._confirmed = confirmed
        return confirmed


class BotConfirmation(Confirmation):
    def __init__(self, ctx: commands.Context, color: hex = 0x000000, message: discord.Message = None):
        self._ctx = ctx

        super().__init__(ctx.bot, color, message)

    async def confirm(self, text: str, user: discord.User = None, channel: discord.TextChannel = None) \
            -> bool or None:

        if user is None:
            user = self._ctx.author

        if self.message is None and channel is None:
            channel = self._ctx.channel

        return await super().confirm(text, user, channel)

disputils

Some utilities for discord.py. Making Discord bot development easier.

MIT
Latest version published 4 years ago

Package Health Score

42 / 100
Full package analysis

Similar packages