setguildicon: Fix logging

This commit is contained in:
Ave Ozkal 2019-02-20 14:32:19 +03:00
parent 6e64367efa
commit 16ae2615bb
No known key found for this signature in database
GPG key ID: 09356ABAA42C842B

View file

@ -19,14 +19,16 @@ class Mod:
@commands.command() @commands.command()
async def setguildicon(self, ctx, url): async def setguildicon(self, ctx, url):
"""Changes guild icon, bot manager only.""" """Changes guild icon, bot manager only."""
imagebytes = await self.bot.aiogetbytes(url) img_bytes = await self.bot.aiogetbytes(url)
await ctx.guild.edit(icon=imagebytes, reason=str(ctx.author)) await ctx.guild.edit(icon=img_bytes, reason=str(ctx.author))
await ctx.send(f"Done!") await ctx.send(f"Done!")
log_channel = self.bot.get_channel(config.modlog_channel) log_channel = self.bot.get_channel(config.modlog_channel)
log_msg = f"✏️ **Guild Icon Update**: {ctx.author} "\ log_msg = f"✏️ **Guild Icon Update**: {ctx.author} "\
"changed the guild icon." "changed the guild icon."
await log_channel.send(log_msg, file=io.BytesIO(imagebytes)) img_file = discord.File(io.BytesIO(img_bytes),
filename=url.split("/")[-1]) # hacky
await log_channel.send(log_msg, file=img_file)
@commands.guild_only() @commands.guild_only()
@commands.check(check_if_staff) @commands.check(check_if_staff)