mirror of
https://github.com/stoatchat/javascript-client-sdk.git
synced 2026-07-20 20:16:06 -04:00
Fix recipients array being filled twice.
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "revolt.js",
|
||||
"version": "4.0.0-alpha.5",
|
||||
"version": "4.0.0-alpha.6",
|
||||
"main": "dist/index.js",
|
||||
"repository": "https://gitlab.insrt.uk/revolt/revolt.js",
|
||||
"author": "Paul Makles <insrt.uk>",
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
export * from './Client';
|
||||
export { Channel, User, Message } from './api/objects';
|
||||
|
||||
export const LIBRARY_VERSION = '4.0.0-alpha.5';
|
||||
export const LIBRARY_VERSION = '4.0.0-alpha.6';
|
||||
|
||||
export const defaultConfig = {
|
||||
apiURL: 'https://api.revolt.chat',
|
||||
|
||||
@@ -41,7 +41,7 @@ export default class Channels extends Collection<Channel> {
|
||||
if (channel.channel_type !== 'Group') throw "Channel is not group channel.";
|
||||
await this.client.req<'PUT', '/channels/:id/recipients/:id'>('PUT', `/channels/${id}/recipients/${user_id}` as any);
|
||||
channel.recipients = [
|
||||
...channel.recipients,
|
||||
...channel.recipients.filter(user => user !== user_id),
|
||||
user_id
|
||||
];
|
||||
}
|
||||
|
||||
@@ -118,9 +118,10 @@ export class WebSocketClient {
|
||||
case 'ChannelGroupJoin': {
|
||||
let channel = await this.client.channels.fetchMutable(packet.id);
|
||||
if (channel.channel_type !== 'Group') throw "Not a group channel.";
|
||||
let user_id = packet.user;
|
||||
channel.recipients = [
|
||||
...channel.recipients,
|
||||
packet.user
|
||||
...channel.recipients.filter(user => user !== user_id),
|
||||
user_id
|
||||
];
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user