mirror of https://gitlab.com/litecord/litecord.git
channel.messages: parse payload_json when creating message
This commit is contained in:
parent
da7ef70458
commit
d9283c92df
|
|
@ -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()]
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue