guilds: add VANITY_URL feature check when editing vanity

This commit is contained in:
Luna 2019-03-13 05:04:48 -03:00
parent afcdd145f4
commit 6763f2c501
1 changed files with 5 additions and 0 deletions

View File

@ -403,6 +403,11 @@ async def get_vanity_url(guild_id: int):
async def change_vanity_url(guild_id: int): async def change_vanity_url(guild_id: int):
"""Get the vanity url of a guild.""" """Get the vanity url of a guild."""
user_id = await token_check() user_id = await token_check()
if not await app.storage.has_feature(guild_id, 'VANITY_URL'):
# TODO: is this the right error
raise BadRequest('guild has no vanity url support')
await guild_perm_check(user_id, guild_id, 'manage_guild') await guild_perm_check(user_id, guild_id, 'manage_guild')
j = validate(await request.get_json(), VANITY_URL_PATCH) j = validate(await request.get_json(), VANITY_URL_PATCH)