Merge pull request #1225 from Ruwin-dsc/patch-1

feat: allows to create a group with only one user
This commit is contained in:
Elysia
2024-07-28 16:30:03 +07:00
committed by GitHub

View File

@@ -127,7 +127,7 @@ class ChannelManager extends CachedManager {
recipients = recipients recipients = recipients
.map(r => this.client.users.resolveId(r)) .map(r => this.client.users.resolveId(r))
.filter(r => r && this.client.relationships.cache.get(r) == RelationshipTypes.FRIEND); .filter(r => r && this.client.relationships.cache.get(r) == RelationshipTypes.FRIEND);
if (recipients.length < 2 || recipients.length > 9) throw new Error('Invalid Users length (2 - 9)'); if (recipients.length <= 0 || recipients.length > 9) throw new Error('Invalid Users length (1 - 9)');
const data = await this.client.api.users['@me'].channels.post({ const data = await this.client.api.users['@me'].channels.post({
data: { recipients }, data: { recipients },
}); });