diff options
Diffstat (limited to '')
| -rw-r--r-- | bot/cogs/utils.py | 18 | 
1 files changed, 18 insertions, 0 deletions
| diff --git a/bot/cogs/utils.py b/bot/cogs/utils.py index 8ea972145..c5eaa547b 100644 --- a/bot/cogs/utils.py +++ b/bot/cogs/utils.py @@ -257,6 +257,24 @@ class Utils(Cog):          embed.description = best_match          await ctx.send(embed=embed) +    @command(aliases=("poll",)) +    @with_role(*MODERATION_ROLES) +    async def vote(self, ctx: Context, title: str, *options: str) -> None: +        """ +        Build a quick voting poll with matching reactions with the provided options. + +        A maximum of 20 options can be provided, as Discord supports a max of 20 +        reactions on a single message. +        """ +        if len(options) > 20: +            raise BadArgument("I can only handle 20 options!") + +        options = {chr(i): f"{chr(i)} - {v}" for i, v in enumerate(options, start=127462)} +        embed = Embed(title=title, description="\n".join(options.values())) +        message = await ctx.send(embed=embed) +        for reaction in options: +            await message.add_reaction(reaction) +  def setup(bot: Bot) -> None:      """Load the Utils cog.""" | 
