mirror of https://gitlab.com/litecord/litecord.git
support undocumented api fields
This commit is contained in:
parent
e3ca982efd
commit
ac1a0eb580
|
|
@ -96,6 +96,16 @@ IDENTIFY_SCHEMA = {
|
|||
},
|
||||
"browser_user_agent": {"type": "string", "required": False},
|
||||
"browser_version": {"type": "string", "required": False},
|
||||
"native_build_number": {
|
||||
"type": "number",
|
||||
"required": False,
|
||||
"nullable": True,
|
||||
},
|
||||
"design_id": {
|
||||
"type": "number",
|
||||
"required": False,
|
||||
"nullable": True,
|
||||
},
|
||||
},
|
||||
},
|
||||
"capabilities": {"type": "number", "required": False},
|
||||
|
|
@ -125,6 +135,10 @@ IDENTIFY_SCHEMA = {
|
|||
"type": "string",
|
||||
"required": False,
|
||||
},
|
||||
"api_code_version": {
|
||||
"type": "number",
|
||||
"required": False,
|
||||
},
|
||||
},
|
||||
},
|
||||
"guild_subscriptions": {"type": "boolean", "required": False},
|
||||
|
|
|
|||
|
|
@ -167,6 +167,7 @@ async def _compute_supplemental(app, base_ready, user_ready, users_to_send: dict
|
|||
|
||||
supplemental["guilds"].append(
|
||||
{
|
||||
"embedded_activities": [],
|
||||
"voice_states": [],
|
||||
"id": guild["id"],
|
||||
}
|
||||
|
|
@ -778,11 +779,12 @@ class GatewayWebsocket:
|
|||
|
||||
async def handle_2(self, payload: Dict[str, Any]):
|
||||
"""Handle the OP 2 Identify packet."""
|
||||
# do not validate given guild_hashes
|
||||
# do not validate given guild_hashes, guild_versions
|
||||
payload_copy = dict(payload)
|
||||
payload_copy["d"].get("client_state", {"guild_hashes": None}).pop(
|
||||
"guild_hashes"
|
||||
)
|
||||
client_state = payload_copy["d"].get("client_state")
|
||||
if client_state:
|
||||
client_state.pop("guild_hashes", None)
|
||||
client_state.pop("guild_versions", None)
|
||||
validate(payload_copy, IDENTIFY_SCHEMA)
|
||||
data = payload["d"]
|
||||
token = data["token"]
|
||||
|
|
|
|||
|
|
@ -236,6 +236,37 @@ class Storage:
|
|||
# feature won't be impl'd
|
||||
drow["guild_scheduled_events"] = []
|
||||
|
||||
# this is NOT a part of documented v10 behavior
|
||||
FIELDS_MIRRORED_TO_PROPERTIES = (
|
||||
"max_members",
|
||||
"afk_channel_id",
|
||||
"features",
|
||||
"owner_id",
|
||||
"explicit_content_filter",
|
||||
"verification_level",
|
||||
"mfa_level",
|
||||
"id",
|
||||
"system_channel_id",
|
||||
"afk_timeout",
|
||||
"vanity_url_code",
|
||||
"public_updates_channel_id",
|
||||
"icon",
|
||||
"rules_channel_id",
|
||||
"banner",
|
||||
"nsfw",
|
||||
"discovery_splash",
|
||||
"splash",
|
||||
"default_message_notifications",
|
||||
"application_id",
|
||||
"home_header",
|
||||
"name",
|
||||
"system_channel_flags",
|
||||
"preferred_locale",
|
||||
)
|
||||
drow["properties"] = {}
|
||||
for field in FIELDS_MIRRORED_TO_PROPERTIES:
|
||||
drow[field] = drow.get(field)
|
||||
|
||||
return drow
|
||||
|
||||
async def _member_basic(self, guild_id: int, member_id: int):
|
||||
|
|
|
|||
Loading…
Reference in New Issue