async def release(self, ctx: commands.Context, errorid: int): data = await self.bot.pg.fetchrow( "SELECT * FROM bob_bugs WHERE id = $1;", errorid) if not data: await ctx.send(f"No bug found with id {errorid}", delete_after=5) await asyncio.sleep(5) try: await ctx.message.delete() finally: return emb = commands.Embed(color=commands.Color.dark_green(), title=f"Bug #{errorid} - {data[2]} (Fixed)", description=data[2]) emb.timestamp = datetime.datetime.utcnow() emb.set_footer(text="Issue released at") await (await self.bot.get_channel(666878516469563402).fetch_message( data[1])).delete() msg = await self.bob_webhook.send(embed=emb, wait=True) await self.bot.pg.execute( "UPDATE bt_bugs SET msgid=$1, resolved=true WHERE id=$2;", msg.id, errorid) await ctx.message.add_reaction("\U0001f44d") await asyncio.sleep(5) try: await ctx.message.delete() except: pass
async def am_ic(self, ctx): """ configure ignored channels """ state = self.states[ctx.guild.id] fmt = ", ".join([ctx.guild.get_channel(x).mention for x in state.ignored_channels if ctx.guild.get_channel(x) is not None]) embed = commands.Embed() embed.description = f"Ignored Channels:\n{fmt}" await ctx.send(embed)
def create_embed(self, message): emb = commands.Embed() emb.title = "Automod" emb.colour = discord.Color.red() emb.timestamp = datetime.datetime.utcnow() emb.set_author(name=str(message.author), icon_url=str(message.author.avatar_url)) emb.set_footer(text=f"User id: {message.author.id}") return emb
async def am_ir(self, ctx): """ shows the currently ignored roles """ state = self.states[ctx.guild.id] fmt = ", ".join( [ctx.guild.get_role(x).mention for x in state.ignores_roles if ctx.guild.get_role(x) is not None]) embed = commands.Embed() embed.description = f"Ignored Roles:\n{fmt}" await ctx.send(embed)
async def track(self, ctx: commands.Context, scriptname, *, issue): prev = await self.bot.pg.fetch("SELECT * FROM bob_bugs;") e = commands.Embed(color=commands.Color.red(), title=f"Bug #{len(prev) + 1} - {scriptname}", description=issue, timestamp=datetime.datetime.utcnow()) e.set_footer(text="Bug registered at") msg = await self.bob_webhook.send(embed=e, wait=True) await self.bot.pg.execute( "INSERT INTO bob_bugs VALUES ($1,$2,$3,$4,false)", len(prev) + 1, msg.id, issue, datetime.datetime.utcnow().timestamp()) await ctx.message.add_reaction("\U0001f44d") await asyncio.sleep(5) try: await ctx.message.delete() except: pass