diff --git a/robocop_ng/cogs/vanity_url.py b/robocop_ng/cogs/vanity_url.py index caf30b7..5cf38fe 100644 --- a/robocop_ng/cogs/vanity_url.py +++ b/robocop_ng/cogs/vanity_url.py @@ -1,4 +1,5 @@ from discord import Guild +from discord.errors import Forbidden from discord.ext import tasks from discord.ext.commands import Cog @@ -14,9 +15,14 @@ class VanityUrl(Cog): async def update_vanity_code(self, guild: Guild, code: str): if "VANITY_URL" in guild.features and guild.vanity_url_code != code: - await guild.edit( - reason="Configured vanity code was different", vanity_code=code - ) + try: + await guild.edit( + reason="Configured vanity code was different", vanity_code=code + ) + except Forbidden: + self.bot.log.exception(f"Not allowed to edit vanity url for: {guild}") + self.cog_unload() + await self.bot.unload_extension("robocop_ng.cogs.vanity_url") @Cog.listener() async def on_guild_update(self, before: Guild, after: Guild): diff --git a/robocop_ng/config_template.py b/robocop_ng/config_template.py index 3d9cf2a..a76d351 100644 --- a/robocop_ng/config_template.py +++ b/robocop_ng/config_template.py @@ -38,7 +38,6 @@ initial_cogs = [ "cogs.links", "cogs.remind", "cogs.robocronp", - "cogs.vanity_url", "cogs.meme", "cogs.invites", "cogs.yubicootp",