detritus-client
Version:
A Typescript NodeJS library to interact with Discord's API, both Rest and Gateway.
31 lines (30 loc) • 872 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConnectedAccounts = void 0;
const basecollection_1 = require("./basecollection");
;
/**
* Connected Accounts Collection
* (Bots cannot fill this)
* @category Collections
*/
class ConnectedAccounts extends basecollection_1.BaseClientCollection {
insert(account) {
if (this.enabled) {
this.set(account.key, account);
}
}
async fill() {
if (this.enabled) {
this.clear();
const accounts = await this.client.rest.fetchMeConnections();
for (let [key, account] of accounts) {
this.insert(account);
}
}
}
get [Symbol.toStringTag]() {
return `ConnectedAccounts (${this.size.toLocaleString()} items)`;
}
}
exports.ConnectedAccounts = ConnectedAccounts;