From c0bac8bc21c856f97aa5e06d0f05947d3b053b96 Mon Sep 17 00:00:00 2001 From: Luna Date: Tue, 10 Aug 2021 23:45:57 -0300 Subject: [PATCH] gateway.schemas: validate Intents as an int --- litecord/blueprints/gateway.py | 3 +++ litecord/gateway/schemas.py | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/litecord/blueprints/gateway.py b/litecord/blueprints/gateway.py index 21097e0..bb90d42 100644 --- a/litecord/blueprints/gateway.py +++ b/litecord/blueprints/gateway.py @@ -61,6 +61,9 @@ async def api_gateway_bot(): reset_ts = bucket._window + bucket.second # how many seconds until bucket reset + # TODO: this logic should be changed to follow update_rate_limit's + # except we can't just call it since we don't use it here, but + # on the gateway side. reset_after_ts = reset_ts - time.time() # reset_after_ts must not be negative diff --git a/litecord/gateway/schemas.py b/litecord/gateway/schemas.py index 4626110..11bc400 100644 --- a/litecord/gateway/schemas.py +++ b/litecord/gateway/schemas.py @@ -23,7 +23,6 @@ from logbook import Logger from litecord.gateway.errors import DecodeError from litecord.schemas import LitecordValidator -from litecord.enums import Intents log = Logger(__name__) @@ -64,7 +63,7 @@ IDENTIFY_SCHEMA = { "large_threshold": {"type": "number", "required": False}, "shard": {"type": "list", "required": False}, "presence": {"type": "dict", "required": False}, - "intents": {"coerce": Intents, "required": False}, + "intents": {"type": int, "required": False}, # TODO schema "properties": { "type": "dict",