fix: opcode 24 (Interaction search function)

Todo: Rewrite slash command ...
This commit is contained in:
March 7th
2022-06-12 19:13:12 +07:00
parent 8eaa5e0c72
commit 07d52ee41b
11 changed files with 45 additions and 54 deletions

View File

@@ -129,7 +129,6 @@ class ChannelManager extends CachedManager {
// Check
if (!recipients || !Array.isArray(recipients)) throw new Error('No recipients || Invalid Type (Array)');
recipients = recipients.filter(r => r instanceof User && r.id && r.friend);
console.log(recipients);
if (recipients.length < 2 || recipients.length > 9) throw new Error('Invalid Users length (2 - 9)');
const data = await this.client.api.users['@me'].channels.post({
data: { recipients: recipients.map(r => r.id) },

View File

@@ -26,6 +26,14 @@ class RelationshipsManager {
this._setup(users);
}
/**
* Return array of cache
* @returns {Array<{id: Snowflake, type: RelationshipTypes}>}
*/
toArray() {
return this.cache.map((value, key) => ({ id: key, type: RelationshipTypes[value] }));
}
/**
* @private
* @param {Array<User>} users An array of users to add to the cache