Group ownership not required for member adding

This commit is contained in:
bforbiggy 2022-08-18 16:19:45 -04:00 committed by GitHub
parent a03703e141
commit 210fb9ae76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -133,15 +133,11 @@ class PartialGroupDMChannel extends Channel {
* @returns {Promise<PartialGroupDMChannel>} * @returns {Promise<PartialGroupDMChannel>}
*/ */
async addMember(user) { async addMember(user) {
if (this.ownerId !== this.client.user.id) {
return Promise.reject(new Error('NOT_OWNER_GROUP_DM_CHANNEL'));
}
user = this.client.users.resolveId(user); user = this.client.users.resolveId(user);
if (!user) { if (!user) {
return Promise.reject(new TypeError('User is not a User or User ID')); return Promise.reject(new TypeError('User is not a User or User ID'));
} }
if (this.recipients.get(user)) return Promise.reject(new Error('USER_ALREADY_IN_GROUP_DM_CHANNEL')); if (this.recipients.get(user)) return Promise.reject(new Error('USER_ALREADY_IN_GROUP_DM_CHANNEL')); // Fails sometimes if member leaves recently (ex. user leave msg's channel used for adding)
//
await this.client.api.channels[this.id].recipients[user].put(); await this.client.api.channels[this.id].recipients[user].put();
this.recipients.set(user, this.client.users.cache.get(user)); this.recipients.set(user, this.client.users.cache.get(user));
return this; return this;