mirror of https://gitlab.com/litecord/litecord.git
dms: add gdm creation on create_group_dm
This commit is contained in:
parent
73da3e0c8e
commit
658b3465c8
|
|
@ -46,7 +46,7 @@ async def _raw_gdm_remove(channel_id, user_id):
|
||||||
""", channel_id, user_id)
|
""", channel_id, user_id)
|
||||||
|
|
||||||
|
|
||||||
async def _gdm_create(user_id, peer_id) -> int:
|
async def gdm_create(user_id, peer_id) -> int:
|
||||||
"""Create a group dm, given two users.
|
"""Create a group dm, given two users.
|
||||||
|
|
||||||
Returns the new GDM id.
|
Returns the new GDM id.
|
||||||
|
|
@ -183,7 +183,7 @@ async def add_to_group_dm(dm_chan, peer_id):
|
||||||
raise BadRequest('Cant insert peer into dm')
|
raise BadRequest('Cant insert peer into dm')
|
||||||
|
|
||||||
if ctype == ChannelType.DM:
|
if ctype == ChannelType.DM:
|
||||||
dm_chan = await _gdm_create(
|
dm_chan = await gdm_create(
|
||||||
user_id, other_id
|
user_id, other_id
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,10 @@ from ..snowflake import get_snowflake
|
||||||
|
|
||||||
from .auth import token_check
|
from .auth import token_check
|
||||||
|
|
||||||
|
from litecord.blueprints.dm_channels import (
|
||||||
|
gdm_create, gdm_add_recipient
|
||||||
|
)
|
||||||
|
|
||||||
log = Logger(__name__)
|
log = Logger(__name__)
|
||||||
bp = Blueprint('dms', __name__)
|
bp = Blueprint('dms', __name__)
|
||||||
|
|
||||||
|
|
@ -122,5 +126,10 @@ async def create_group_dm(p_user_id: int):
|
||||||
# its a group dm with 1 user... a dm!
|
# its a group dm with 1 user... a dm!
|
||||||
return await create_dm(user_id, int(recipients[0]))
|
return await create_dm(user_id, int(recipients[0]))
|
||||||
|
|
||||||
# TODO: group dms
|
# create a group dm with multiple users
|
||||||
return 'group dms not implemented', 500
|
channel_id = await gdm_create(user_id, recipients[0])
|
||||||
|
|
||||||
|
for recipient in recipients[1:]:
|
||||||
|
await gdm_add_recipient(channel_id, recipient)
|
||||||
|
|
||||||
|
return jsonify(await app.storage.get_channel(channel_id))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue