mirror of https://gitlab.com/litecord/litecord.git
add validation for guild sync
This commit is contained in:
parent
e01d1b8465
commit
173a2330fe
|
|
@ -99,6 +99,16 @@ REQ_GUILD_SCHEMA = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GUILD_SYNC_SCHEMA = {
|
||||||
|
**BASE,
|
||||||
|
**{
|
||||||
|
"d": {
|
||||||
|
"type": "list",
|
||||||
|
"schema": {"type": "snowflake"},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
GW_ACTIVITY = {
|
GW_ACTIVITY = {
|
||||||
"name": {"type": "string", "required": True},
|
"name": {"type": "string", "required": True},
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ from litecord.gateway.schemas import (
|
||||||
GW_STATUS_UPDATE,
|
GW_STATUS_UPDATE,
|
||||||
RESUME_SCHEMA,
|
RESUME_SCHEMA,
|
||||||
REQ_GUILD_SCHEMA,
|
REQ_GUILD_SCHEMA,
|
||||||
|
GUILD_SYNC_SCHEMA,
|
||||||
)
|
)
|
||||||
|
|
||||||
from litecord.storage import int_
|
from litecord.storage import int_
|
||||||
|
|
@ -952,6 +953,7 @@ class GatewayWebsocket:
|
||||||
|
|
||||||
async def handle_12(self, payload: Dict[str, Any]):
|
async def handle_12(self, payload: Dict[str, Any]):
|
||||||
"""Handle OP 12 Guild Sync."""
|
"""Handle OP 12 Guild Sync."""
|
||||||
|
payload = validate(payload, GUILD_SYNC_SCHEMA)
|
||||||
data = payload["d"]
|
data = payload["d"]
|
||||||
gids = await self.user_storage.get_user_guilds(self.state.user_id)
|
gids = await self.user_storage.get_user_guilds(self.state.user_id)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue