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
+6 -1
View File
@@ -98,12 +98,17 @@ class Admin(base.Cog):
after (discord.Guild): The server after it being updated.
"""
vanity = await after.vanity_invite()
vanity_code = None
try:
vanity = await after.vanity_invite()
if vanity is not None:
vanity_code = vanity.code
except errors.DiscordException:
pass
await models.Server.update_or_create(
{"name": after.name, "vanity_code": vanity_code}, id=after.id
)