import asyncio import logging import discord from discord.ext import commands from essentials.multi_server import get_server_pre, ask_for_server from essentials.settings import SETTINGS class Help(commands.Cog): def __init__(self, bot): self.bot = bot self.pages = ['šŸ ', 'šŸ†•', 'šŸ”', 'šŸ•¹', 'šŸ› ', 'ā”', 'šŸ’–'] async def embed_list_reaction_handler(self, ctx, page, pre, msg=None): embed = self.get_help_embed(page, pre) if msg is None: msg = await ctx.send(embed=embed) # add reactions for emoji in self.pages: await msg.add_reaction(emoji) else: await msg.edit(embed=embed) # wait for reactions (3 minutes) def check(rct, usr): return True if usr != self.bot.user and str(rct.emoji) in self.pages and rct.message.id == msg.id else False try: reaction, user = await self.bot.wait_for('reaction_add', timeout=180, check=check) except asyncio.TimeoutError: await msg.delete() return None else: if isinstance(reaction.message.channel, discord.TextChannel): await reaction.message.remove_reaction(reaction.emoji, user) return reaction def get_help_embed(self, page, pre): title = f' Pollmaster Help - React with an emoji to learn more about a topic!' embed = discord.Embed(title='', description='', colour=SETTINGS.color) embed.set_author(name=title, icon_url=SETTINGS.author_icon) embed.set_footer(text='Use reactions to navigate the help. This message will self-destruct in 3 minutes.') if page == 'šŸ ': # POLL CREATION SHORT embed.add_field(name='šŸ†• Making New Polls', value=f'`{pre}quick` | `{pre}new` | `{pre}advanced` | `{pre}prepare` | `{pre}cmd `', inline=False) # embed.add_field(name='Commands', value=f'`{pre}quick` | `{pre}new` | `{pre}prepared`', inline=False) # embed.add_field(name='Arguments', value=f'Arguments: `` (optional)', inline=False) # embed.add_field(name='Examples', value=f'Examples: `{pre}new` | `{pre}quick What is the greenest color?`', # inline=False) ## POLL CONTROLS embed.add_field(name='šŸ” Show Polls', value=f'`{pre}show` | `{pre}show