From 6e64367efafb79cca380f443b5421d6fe4a64027 Mon Sep 17 00:00:00 2001 From: Ave Ozkal Date: Wed, 20 Feb 2019 14:21:50 +0300 Subject: [PATCH] setguildicon: add --- cogs/mod.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/cogs/mod.py b/cogs/mod.py index 01d0b60..02e4a27 100644 --- a/cogs/mod.py +++ b/cogs/mod.py @@ -1,9 +1,10 @@ import discord from discord.ext import commands import config -from helpers.checks import check_if_staff +from helpers.checks import check_if_staff, check_if_bot_manager from helpers.userlogs import userlog from helpers.restrictions import add_restriction, remove_restriction +import io class Mod: @@ -13,6 +14,20 @@ class Mod: def check_if_target_is_staff(self, target): return any(r.id in config.staff_role_ids for r in target.roles) + @commands.guild_only() + @commands.check(check_if_bot_manager) + @commands.command() + async def setguildicon(self, ctx, url): + """Changes guild icon, bot manager only.""" + imagebytes = await self.bot.aiogetbytes(url) + await ctx.guild.edit(icon=imagebytes, reason=str(ctx.author)) + await ctx.send(f"Done!") + + log_channel = self.bot.get_channel(config.modlog_channel) + log_msg = f"✏️ **Guild Icon Update**: {ctx.author} "\ + "changed the guild icon." + await log_channel.send(log_msg, file=io.BytesIO(imagebytes)) + @commands.guild_only() @commands.check(check_if_staff) @commands.command()