mirror of https://gitlab.com/litecord/litecord.git
parent
0dbfb3a210
commit
633cd730c0
|
|
@ -371,3 +371,23 @@ async def ack_guild(guild_id):
|
||||||
await channel_ack(user_id, guild_id, chan_id)
|
await channel_ack(user_id, guild_id, chan_id)
|
||||||
|
|
||||||
return '', 204
|
return '', 204
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route('/<int:guild_id>/vanity-url', methods=['GET'])
|
||||||
|
async def get_vanity_url(guild_id: int):
|
||||||
|
"""Get the vanity url of a guild."""
|
||||||
|
user_id = await token_check()
|
||||||
|
|
||||||
|
await guild_perm_check(user_id, guild_id, 'manage_guild')
|
||||||
|
|
||||||
|
inv_code = await app.db.fetchval("""
|
||||||
|
SELECT code FROM vanity_invites
|
||||||
|
WHERE guild_id = $1
|
||||||
|
""", guild_id)
|
||||||
|
|
||||||
|
if inv_code is None:
|
||||||
|
return jsonify({'code': None})
|
||||||
|
|
||||||
|
return jsonify(
|
||||||
|
await app.storage.get_invite(inv_code)
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
-- vanity url table, the mapping is 1-1 for guilds and vanity urls
|
||||||
|
CREATE TABLE IF NOT EXISTS vanity_invites (
|
||||||
|
guild_id bigint REFERENCES guilds (id) PRIMARY KEY,
|
||||||
|
code text REFERENCES invites (code) ON DELETE CASCADE
|
||||||
|
);
|
||||||
|
|
@ -527,6 +527,12 @@ CREATE TABLE IF NOT EXISTS invites (
|
||||||
revoked bool DEFAULT false
|
revoked bool DEFAULT false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
-- vanity url table, the mapping is 1-1 for guilds and vanity urls
|
||||||
|
CREATE TABLE IF NOT EXISTS vanity_invites (
|
||||||
|
guild_id bigint REFERENCES guilds (id) PRIMARY KEY,
|
||||||
|
code text REFERENCES invites (code) ON DELETE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS webhooks (
|
CREATE TABLE IF NOT EXISTS webhooks (
|
||||||
id bigint PRIMARY KEY,
|
id bigint PRIMARY KEY,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue