dist/cache/ChannelMapCache.js
/**
     * Upsert a ChannelMap
     * @param id Id of the user or the guild
     * @param data Array of channel ids
     * @param type Type of the map to upsert
     * @param remove Remove old channels that don't exist anymore
     */
Upsert a ChannelMap
@param id Id of the user or the guild
@param data Array of channel ids
@param type Type of the map to upsert
@param remove Remove old channels that don't exist anymore
Upsert a ChannelMap @param id Id of the user or the guild @param data Array of channel ids @param type Type of the map to upsert @param remove Remove old channels that don ' t exist anymore
async update(id, data, type = "guild", remove = false) {
        if (this.boundObject) {
            this.bindObject(this._buildMap(id, data, type)); 
        }
        let oldCacheData = await this.get(id, type);
        if (oldCacheData && !remove) {
            data = this._checkDupes(oldCacheData.channels, data);
        }
        if (remove) {
            if (!oldCacheData) {
                oldCacheData = { channels: [] };
            }
            data = this._removeOldChannels(oldCacheData.channels, data);
        }
        const channelMapId = this.buildId(this._buildMapId(id, type));
        await this.remove(id, type);
        await Promise.all(data.map(i => { var _a; return (_a = this.storageEngine) === null || _a === void 0 ? void 0 : _a.addToList(channelMapId, i); }));
        if (this.boundObject)
            return this;
        return new ChannelMapCache(this.storageEngine, this.rain, this._buildMap(id, data, type));
    }
async update ( id , data , type = "guild" , remove = false ) { if ( this . boundObject ) { this . bindObject ( this . _buildMap ( id , data , type ) ) ; } let oldCacheData = await this . get ( id , type ) ; if ( oldCacheData && ! remove ) { data = this . _checkDupes ( oldCacheData . channels , data ) ; } if ( remove ) { if ( ! oldCacheData ) { oldCacheData = { channels : [ ] } ; } data = this . _removeOldChannels ( oldCacheData . channels , data ) ; } const channelMapId = this . buildId ( this . _buildMapId ( id , type ) ) ; await this . remove ( id , type ) ; await Promise . all ( data . map ( i => { var _a ; return ( _a = this . storageEngine ) === null || _a === void 0 ? void 0 : _a . addToList ( channelMapId , i ) ; } ) ) ; if ( this . boundObject ) return this ; return new ChannelMapCache ( this . storageEngine , this . rain , this . _buildMap ( id , data , type ) ) ; }
Upsert a ChannelMap
 @param id Id of the user or the guild
 @param data Array of channel ids
 @param type Type of the map to upsert
 @param remove Remove old channels that don't exist anymore
Upsert a ChannelMap @param id Id of the user or the guild @param data Array of channel ids @param type Type of the map to upsert @param remove Remove old channels that don ' t exist anymore
//using bindobject() to assure the data of the class is valid // @ts-ignore // @ts-ignore // @ts-ignore