mirror of https://gitlab.com/litecord/litecord.git
blueprints.guilds: add create_guild_settings
This commit is contained in:
parent
25b34c6a8a
commit
809518f85f
|
|
@ -26,6 +26,16 @@ async def guild_owner_check(user_id: int, guild_id: int):
|
||||||
raise Forbidden('You are not the owner of the guild')
|
raise Forbidden('You are not the owner of the guild')
|
||||||
|
|
||||||
|
|
||||||
|
async def create_guild_settings(guild_id: int, user_id: int):
|
||||||
|
"""Create guild settings for the user
|
||||||
|
joining the guild."""
|
||||||
|
|
||||||
|
await app.db.execute("""
|
||||||
|
INSERT INTO guild_settings (user_id, guild_id)
|
||||||
|
VALUES ($1, $2)
|
||||||
|
""", user_id, guild_id)
|
||||||
|
|
||||||
|
|
||||||
@bp.route('', methods=['POST'])
|
@bp.route('', methods=['POST'])
|
||||||
async def create_guild():
|
async def create_guild():
|
||||||
user_id = await token_check()
|
user_id = await token_check()
|
||||||
|
|
@ -49,6 +59,8 @@ async def create_guild():
|
||||||
VALUES ($1, $2)
|
VALUES ($1, $2)
|
||||||
""", user_id, guild_id)
|
""", user_id, guild_id)
|
||||||
|
|
||||||
|
await create_guild_settings(guild_id, user_id)
|
||||||
|
|
||||||
await app.db.execute("""
|
await app.db.execute("""
|
||||||
INSERT INTO roles (id, guild_id, name, position, permissions)
|
INSERT INTO roles (id, guild_id, name, position, permissions)
|
||||||
VALUES ($1, $2, $3, $4, $5)
|
VALUES ($1, $2, $3, $4, $5)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue