dist/cache/GuildCache.js
/**
     * Removes a guild and associated elements from the cache.
     * @param id id of the guild to remove
     */
Removes a guild and associated elements from the cache.
@param id id of the guild to remove
Removes a guild and associated elements from the cache . @param id id of the guild to remove
async remove(id) {
        var _a, _b, _c, _d;
        const guild = await ((_a = this.storageEngine) === null || _a === void 0 ? void 0 : _a.get(this.buildId(id)));
        if (guild) {
            const channelMap = await this.guildChannelMap.get(id);
            const roles = await this.roles.getIndexMembers(id);
            const emojis = await this.emojis.getIndexMembers(id);
            const members = await this.members.getIndexMembers(id);
            for (const emoji of emojis) {
                await this.emojis.remove(emoji, id);
            }
            for (const role of roles) {
                await this.roles.remove(role, id);
            }
            for (const channel of ((_c = (_b = channelMap) === null || _b === void 0 ? void 0 : _b.boundObject) === null || _c === void 0 ? void 0 : _c.channels) || []) {
                await this.channels.remove(channel);
            }
            for (const member of members) {
                await this.members.remove(member, id);
            }
            await this.guildChannelMap.remove(id);
            await this.removeFromIndex(id);
            return (_d = this.storageEngine) === null || _d === void 0 ? void 0 : _d.remove(this.buildId(id));
        }
        else {
            return undefined;
        }
    }
async remove ( id ) { var _a , _b , _c , _d ; const guild = await ( ( _a = this . storageEngine ) === null || _a === void 0 ? void 0 : _a . get ( this . buildId ( id ) ) ) ; if ( guild ) { const channelMap = await this . guildChannelMap . get ( id ) ; const roles = await this . roles . getIndexMembers ( id ) ; const emojis = await this . emojis . getIndexMembers ( id ) ; const members = await this . members . getIndexMembers ( id ) ; for ( const emoji of emojis ) { await this . emojis . remove ( emoji , id ) ; } for ( const role of roles ) { await this . roles . remove ( role , id ) ; } for ( const channel of ( ( _c = ( _b = channelMap ) === null || _b === void 0 ? void 0 : _b . boundObject ) === null || _c === void 0 ? void 0 : _c . channels ) || [ ] ) { await this . channels . remove ( channel ) ; } for ( const member of members ) { await this . members . remove ( member , id ) ; } await this . guildChannelMap . remove ( id ) ; await this . removeFromIndex ( id ) ; return ( _d = this . storageEngine ) === null || _d === void 0 ? void 0 : _d . remove ( this . buildId ( id ) ) ; } else { return undefined ; } }
Removes a guild and associated elements from the cache.
Removes a guild and associated elements from the cache .