fix(bot): 🐛 on_guild_update crashing when bot doesn't have Manage Server permissions.
This commit is contained in:
@@ -98,11 +98,16 @@ class Admin(base.Cog):
|
||||
after (discord.Guild): The server after it being updated.
|
||||
"""
|
||||
|
||||
vanity = await after.vanity_invite()
|
||||
vanity_code = None
|
||||
|
||||
if vanity is not None:
|
||||
vanity_code = vanity.code
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user