From c87ade2e08b0117bd5a0db5611ce47287fbfb6de Mon Sep 17 00:00:00 2001 From: AnInternetTroll Date: Sun, 14 Jun 2020 12:09:39 +0200 Subject: Better logging --- cogs/admin.py | 2 +- cogs/general.py | 23 +++++------------------ cogs/logs.py | 5 ++++- cogs/src.py | 3 ++- 4 files changed, 12 insertions(+), 21 deletions(-) (limited to 'cogs') diff --git a/cogs/admin.py b/cogs/admin.py index 3cb7ff8..d722390 100644 --- a/cogs/admin.py +++ b/cogs/admin.py @@ -24,7 +24,7 @@ class Admin(commands.Cog): @commands.check(is_mod) async def forceexit(self, ctx, password): if password == "abort": - ctx.message.delete() + await ctx.message.delete() exit() @commands.command() diff --git a/cogs/general.py b/cogs/general.py index ccc4b28..2e25410 100644 --- a/cogs/general.py +++ b/cogs/general.py @@ -21,20 +21,9 @@ class General(commands.Cog): if not user: user = ctx.message.author - # Very very shit - """ - await ctx.send(str(user.avatar_url)) - request.urlretrieve(str(user.avatar_url), "temp.webp") - #filename = wget.download(user.avatar_url, out="temp.webp") - image = Image.open("temp.webp").convert("RGB") - image.save("temp.png", "PNG") - - f = discord.File("temp.png", filename="temp.png") - #await messagable.send(file=f, embed=e) - """ output = "" for i in user.roles: - output += i.mention + output += i.mention + " " if user.color.value == 0: color = 16777210 @@ -43,8 +32,7 @@ class General(commands.Cog): embed=discord.Embed(title=user.name, description=user.mention, color=color, timestamp=ctx.message.created_at) #embed.set_thumbnail(url="attachment://temp.webp") - embed.set_thumbnail(url=user.avatar_url) - embed.set_image(url="attachment://temp.png") + embed.set_thumbnail(url=user.avatar_url_as(format="png")) embed.add_field(name="Nickname", value=user.display_name, inline=False) embed.add_field(name="Joined on", value=user.joined_at.date(), inline=True) embed.add_field(name="Status", value=user.status, inline=True) @@ -59,7 +47,7 @@ class General(commands.Cog): async def coop(self, ctx, *, user: discord.Member=None): if not user: user = ctx.message.author - elif type(user)=="str": + else: user = self.bot.get_user(int(user)) coop_role = ctx.guild.get_role(694261282861219952) @@ -89,9 +77,8 @@ class General(commands.Cog): emojiList += str(i) + " " embed=discord.Embed(title=guild.name, description=guild.description, color=color, timestamp=ctx.message.created_at) - #embed.set_thumbnail(url="attachment://temp.webp") - embed.set_thumbnail(url=guild.icon_url) - embed.set_image(url=guild.splash_url) + embed.set_thumbnail(url=guild.icon_url_as(format="png")) + embed.set_image(url=guild.splash_url_as(format="png")) embed.add_field(name="Created on", value=guild.created_at.date(), inline=True) embed.add_field(name="Members", value=guild.member_count, inline=True) embed.add_field(name="Emojis", value=emojiList, inline=True) diff --git a/cogs/logs.py b/cogs/logs.py index c6f18b5..d6889eb 100644 --- a/cogs/logs.py +++ b/cogs/logs.py @@ -8,6 +8,9 @@ class Logs(commands.Cog): @commands.Cog.listener() async def on_message_delete(self, message): + if (message.id in self.bot.messageBlacklist): + self.bot.messageBlacklist.remove(message.id) + return if message.guild.id != 574267523869179904: return if message.author.color.value == 0: @@ -17,7 +20,7 @@ class Logs(commands.Cog): channel = self.bot.get_channel(718187032869994686) embed = discord.Embed( title='Deleted Message', - color=message, + color=color, timestamp=message.created_at ) embed.add_field( diff --git a/cogs/src.py b/cogs/src.py index 96bf53c..f0619d4 100644 --- a/cogs/src.py +++ b/cogs/src.py @@ -208,7 +208,7 @@ class Src(commands.Cog): @commands.guild_only() async def pending(self, ctx): async with ctx.typing(): - await clear(self) + await self.bot.get_channel(699713639866957905).purge() await pendingRuns(self, ctx) @commands.command(description="Reject runs quickly") @@ -231,6 +231,7 @@ class Src(commands.Cog): @commands.command() async def verify(self, ctx, apiKey=None, userID=None): + self.bot.messageBlacklist.append(ctx.message.id) #if apiKey == None: # await ctx.send(f"Please try again this command by getting an apiKey from https://www.speedrun.com/api/auth then do `{ctx.prefix}verify ` in my DMs or anywhere in this server. \nBe careful who you share this key with. To learn more check out https://github.com/speedruncomorg/api/blob/master/authentication.md") # return -- cgit v1.2.3