fix(bot): 🐛 on_guild_update crashing when bot doesn't have Manage Server permissions.
This commit is contained in:
@@ -98,12 +98,17 @@ 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
|
||||||
|
|
||||||
|
try:
|
||||||
|
vanity = await after.vanity_invite()
|
||||||
|
|
||||||
if vanity is not None:
|
if vanity is not None:
|
||||||
vanity_code = vanity.code
|
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
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user