return user objects on dm.recipients

but don't keep self user inside
This commit is contained in:
Luna 2021-09-02 00:25:41 -03:00
parent e2ffaa119d
commit 09cb230d95
1 changed files with 5 additions and 4 deletions

View File

@ -49,10 +49,11 @@ async def jsonify_dm(dm_id: int, user_id: int):
dm_chan = await app.storage.get_dm(dm_id, user_id) dm_chan = await app.storage.get_dm(dm_id, user_id)
if request.discord_api_version > 7: if request.discord_api_version > 7:
new_recipients = [] self_user_index = index_by_func(
for recipient_user in dm_chan["recipients"]: lambda user: user["id"] == str(user_id), dm_chan["recipients"]
new_recipients.append(recipient_user["id"]) )
dm_chan["recipients"] = new_recipients assert self_user_index is not None
dm_chan["recipients"].remove(self_user_index)
return jsonify(dm_chan) return jsonify(dm_chan)