mirror of https://gitlab.com/litecord/litecord.git
dms: add support for v9 create dm
This commit is contained in:
parent
3b17fd3d7d
commit
829316dae9
|
|
@ -105,8 +105,13 @@ async def create_dm(user_id, recipient_id):
|
||||||
async def start_dm():
|
async def start_dm():
|
||||||
"""Create a DM with a user."""
|
"""Create a DM with a user."""
|
||||||
user_id = await token_check()
|
user_id = await token_check()
|
||||||
j = validate(await request.get_json(), CREATE_DM)
|
j = validate(
|
||||||
recipient_id = j["recipient_id"]
|
await request.get_json(),
|
||||||
|
CREATE_GROUP_DM_V9 if request.discord_api_version == 9 else CREATE_DM,
|
||||||
|
)
|
||||||
|
recipient_id: str = (
|
||||||
|
j["recipients"][0] if request.discord_api_version == 9 else j["recipient_id"]
|
||||||
|
)
|
||||||
|
|
||||||
return await create_dm(user_id, recipient_id)
|
return await create_dm(user_id, recipient_id)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -534,11 +534,11 @@ RELATIONSHIP = {
|
||||||
CREATE_DM = {"recipient_id": {"type": "snowflake", "required": True}}
|
CREATE_DM = {"recipient_id": {"type": "snowflake", "required": True}}
|
||||||
|
|
||||||
CREATE_GROUP_DM = {
|
CREATE_GROUP_DM = {
|
||||||
"recipients": {"type": "list", "required": True, "schema": {"type": "snowflake"}}
|
"recipient_id": {"type": "list", "required": True, "schema": {"type": "snowflake"}}
|
||||||
}
|
}
|
||||||
|
|
||||||
CREATE_GROUP_DM_V9 = {
|
CREATE_GROUP_DM_V9 = {
|
||||||
"recipient_id": {"type": "list", "required": True, "schema": {"type": "snowflake"}}
|
"recipients": {"type": "list", "required": True, "schema": {"type": "snowflake"}}
|
||||||
}
|
}
|
||||||
|
|
||||||
GROUP_DM_UPDATE = {
|
GROUP_DM_UPDATE = {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue