fix(bot): 🐛 on_guild_update crashing when bot doesn't have Manage Server permissions.

This commit is contained in:
Nyeki.py
2024-10-19 01:25:11 -03:00
parent cef90677d7
commit 70587d89e1
+8 -3
View File
@@ -98,11 +98,16 @@ class Admin(base.Cog):
after (discord.Guild): The server after it being updated. after (discord.Guild): The server after it being updated.
""" """
vanity = await after.vanity_invite()
vanity_code = None vanity_code = None
if vanity is not None: try:
vanity_code = vanity.code vanity = await after.vanity_invite()
if vanity is not None:
vanity_code = vanity.code
except errors.DiscordException:
pass
await models.Server.update_or_create( await models.Server.update_or_create(
{"name": after.name, "vanity_code": vanity_code}, id=after.id {"name": after.name, "vanity_code": vanity_code}, id=after.id