diff --git a/litecord/blueprints/channel/messages.py b/litecord/blueprints/channel/messages.py index 5d94b56..72aba0e 100644 --- a/litecord/blueprints/channel/messages.py +++ b/litecord/blueprints/channel/messages.py @@ -336,10 +336,15 @@ async def _msg_input() -> tuple: 'tts': json.loads(form.get('tts', 'false')), } + payload_json = json.loads(form.get('payload_json', '{}')) + json_from_form.update(request_json) + json_from_form.update(payload_json) files = await request.files - # we don't really care about the given fields on the files dict + + # we don't really care about the given fields on the files dict, so + # we only extract the values return json_from_form, [v for k, v in files.items()] diff --git a/litecord/schemas.py b/litecord/schemas.py index c39c46d..8b4fd28 100644 --- a/litecord/schemas.py +++ b/litecord/schemas.py @@ -88,7 +88,6 @@ class LitecordValidator(Validator): return False def _validate_type_voice_region(self, value: str) -> bool: - # TODO: complete this list return value.lower() in ('brazil', 'us-east', 'us-west', 'us-south', 'russia') @@ -394,6 +393,8 @@ MEMBER_UPDATE = { } +# NOTE: things such as payload_json are parsed at the handler +# for creating a message. MESSAGE_CREATE = { 'content': {'type': 'string', 'minlength': 0, 'maxlength': 2000}, 'nonce': {'type': 'snowflake', 'required': False}, @@ -404,8 +405,6 @@ MESSAGE_CREATE = { 'schema': EMBED_OBJECT, 'required': False } - - # TODO: file, embed, payload_json }