async def pushboard_info(self, ctx): """Provides info on guild's pushboard""" guild_config = await self.bot.get_guild_config(ctx.guild.id) table = CLYTable() table.title = guild_config.pushboard_title or "PushBoard" if guild_config.pushboard_render == 2: table.add_rows([[0, 4721, 56, "Rowcoy"], [1, 4709, 42, "Stitch"], [2, 4658, 37, "t3pps"]]) render = table.render_option_2() else: table.add_rows([[0, 4721, "Rowcoy (Awesome Clan)"], [1, 4709, "Stitch (Lilo's Clan)"], [2, 4658, "t3pps (Other Clan)"]]) render = table.render_option_1() fmt = f"**PushBoard Example Format:**\n\n{render}\n" \ f"**Icon:** Please see the icon displayed above.\n" channel = guild_config.pushboard data = [] if channel is None: data.append("**Channel:** #deleted-channel") else: data.append(f"**Channel:** {channel.mention}") sql = "SELECT clan_name, clan_tag FROM clans WHERE guild_id = $1" fetch = await ctx.db.fetch(sql, ctx.guild.id) data.append(f"**Clans:** {', '.join(f'{n[0]} ({n[1]})' for n in fetch)}") fmt += "\n".join(data) embed = discord.Embed(color=self.bot.color, description=fmt) embed.set_author(name="PushBoard Info", icon_url=guild_config.icon_url or "https://cdn.discordapp.com/emojis/" "592028799768592405.png?v=1") await ctx.send(embed=embed)
async def info_trophyboard(self, ctx): """Gives you info about guild's trophyboard. """ table = CLYTable() if ctx.config.render == 1: table.add_rows([[0, 4320, 955, 'Member Name'], [1, 4500, 870, 'Another Member'], [2, 3900, -600, 'Yet Another'], [3, 1500, -1000, 'Worst Pusher'] ]) table.title = ctx.config.title or 'TrophyBoard' render = table.trophyboard_1() else: table.add_rows([[0, 2000, 'Member'], [1, 1500, 'Nearly #1'], [2, 1490, 'Another Member'], [3, -600, 'Winner'] ]) table.title = ctx.config.title or 'TrophyBoard' render = table.trophyboard_2() fmt = f'**Trophyboard Example Format:**\n\n{render}\n**Icon:** ' \ f'Please see the icon displayed above.\n' channel = ctx.config.channel data = [] if channel is None: data.append('**Channel:** #deleted-channel') else: data.append(f'**Channel:** {channel.mention}') query = "SELECT clan_name, clan_tag FROM clans WHERE guild_id = $1;" fetch = await ctx.db.fetch(query, ctx.guild.id) data.append(f"**Clans:** {', '.join(f'{n[0]} ({n[1]})' for n in fetch)}") fmt += '\n'.join(data) e = discord.Embed(colour=self.bot.colour, description=fmt if len(fmt) < 2048 else f'{fmt[:2040]}...') e.set_author(name='TrophyBoard Info', icon_url=ctx.config.icon_url or 'https://cdn.discordapp.com/emojis/592028799768592405.png?v=1') await ctx.send(embed=e)
async def info_donationboard(self, ctx): """Gives you info about guild's donationboard. """ table = CLYTable() if ctx.config.render == 2: table.add_rows([[0, 6532, 'Member (Awesome Clan)'], [1, 4453, 'Nearly #1 (Bad Clan)'], [2, 5589, 'Another Member (Awesome Clan)'], [3, 0, 'Winner (Bad Clan)'] ]) table.title = ctx.config.title or 'DonationBoard' render = table.donationboard_2() else: table.add_rows([[0, 9913, 12354, 'Member Name'], [1, 524, 123, 'Another Member'], [2, 321, 444, 'Yet Another'], [3, 0, 2, 'The Worst Donator'] ]) table.title = ctx.config.title or 'DonationBoard' render = table.donationboard_1() fmt = f'**DonationBoard Example Format:**\n\n{render}\n**Icon:** ' \ f'Please see the icon displayed above.\n' channel = ctx.config.channel data = [] if channel is None: data.append('**Channel:** #deleted-channel') else: data.append(f'**Channel:** {channel.mention}') query = "SELECT clan_name, clan_tag FROM clans WHERE guild_id = $1;" fetch = await ctx.db.fetch(query, ctx.guild.id) data.append(f"**Clans:** {', '.join(f'{n[0]} ({n[1]})' for n in fetch)}") fmt += '\n'.join(data) e = discord.Embed(colour=self.bot.colour, description=fmt if len(fmt) < 2048 else f'{fmt[:2040]}...') e.set_author(name='DonationBoard Info', icon_url=ctx.config.icon_url or 'https://cdn.discordapp.com/emojis/592028799768592405.png?v=1') await ctx.send(embed=e)
async def pushboard_edit(self, ctx): """Edit the format of the guild's pushboard""" table = CLYTable() table.add_rows([[0, 4721, 56, "Rowcoy"], [1, 4709, 42, "Stitch"], [2, 4658, 37, "t3pps"]]) table.title = "**Option 1 Example**" option_1_render = f"**Option 1 Example**\n{table.render_option_1()}" table.clear_rows() table.add_rows([[0, 4721, "Rowcoy (Awesome Clan)"], [1, 4709, "Stitch (Lilo's Clan)"], [2, 4658, "t3pps (Other Clan)"]]) option_2_render = f"**Option 2 Example**\n{table.render_option_2()}" embed = discord.Embed(color=self.bot.color) fmt = (f"{option_1_render}\n\n{option_2_render}\n\n\n" f"These are the 2 available options.\n" f"Please click the reaction of the format you \n" f"wish to display on your pushboard.") embed.description = fmt msg = await ctx.send(embed=embed) sql = "UPDATE guilds SET pushboard_render = $1 WHERE guild_id = $2" reactions = ["1\N{combining enclosing keycap}", "2\N{combining enclosing keycap}"] for r in reactions: await msg.add_reaction(r) def check(r, u): return str(r) in reactions and u.id == ctx.author.id and r.message.id == msg.id try: r,u = await self.bot.wait_for("reaction_add", check=check, timeout=60.0) except asyncio.TimeoutError: await ctx.db.execute(sql, 1, ctx.guild.id) return await ctx.send("I got bored waiting and selected Option 1 for you.") await ctx.db.execute(sql, reactions.index(str(r)) + 1, ctx.guild.id) await ctx.confirm() await ctx.send("All done. Thank you!") self.get_guild_config.invalidate(self, ctx.guild.id)
async def edit_trophyboard_format(self, ctx): """Edit the format of the guild's trophyboard. The bot will provide 2 options and you must select 1 via reactions. **Format** :information_source: `+edit trophyboard format` **Example** :white_check_mark: `+edit trophyboard format` **Required Permissions** :warning: Manage Server """ table = CLYTable() table.add_rows([[0, 4320, 955, 'Member Name'], [1, 4500, 870, 'Another Member'], [2, 3900, -600, 'Yet Another'], [3, 1500, -1000, 'Worst Pusher']]) table.title = '**Option 1 Example**' option_1_render = f'**Option 1 Example**\n{table.trophyboard_1()}' table.clear_rows() table.add_rows([[0, 2000, 'Member'], [1, 1500, 'Nearly #1'], [2, 1490, 'Another Member'], [3, -600, 'Winner']]) option_2_render = f'**Option 2 Example**\n{table.trophyboard_2()}' embed = discord.Embed(colour=self.bot.colour) fmt = f'{option_1_render}\n\n\n{option_2_render}\n\n\n' \ f'These are the 2 available default options.\n' \ f'Please hit the reaction of the format you \nwish to display on the trophyboard.' embed.description = fmt msg = await ctx.send(embed=embed) query = "UPDATE boards SET render=$1 WHERE channel_id=$2" reactions = [ '1\N{combining enclosing keycap}', '2\N{combining enclosing keycap}' ] for r in reactions: await msg.add_reaction(r) def check(r, u): return str( r ) in reactions and u.id == ctx.author.id and r.message.id == msg.id try: r, u = await self.bot.wait_for('reaction_add', check=check, timeout=60.0) except asyncio.TimeoutError: await ctx.db.execute(query, 1, ctx.config.channel_id) return await ctx.send('You took too long. Option 1 was chosen.') await ctx.db.execute(query, reactions.index(str(r)) + 1, ctx.config.channel_id) await ctx.confirm()