dist/cache/ChannelCache.js
/**
     * Upsert a channel into the cache
     * @param id id of the channel
     * @param data data to insert
     */
Upsert a channel into the cache
@param id id of the channel
@param data data to insert
Upsert a channel into the cache @param id id of the channel @param data data to insert
async update(id, data) {
        var _a, _b;
        if (this.boundObject) {
            this.bindObject(data); 
        }
        if (data.guild_id) {
            await this.channelMap.update(data.guild_id, [data.id]);
        }
        else if (data.recipients) {
            if (data.recipients[0]) {
                await this.channelMap.update(data.recipients[0].id, [data.id], "user");
            }
        }
        if (data.permission_overwrites) {
            for (const overwrite of data.permission_overwrites) {
                await this.permissionOverwrites.update(overwrite.id, id, overwrite);
            }
        }
        delete data.permission_overwrites;
        delete data.recipients;
        await this.addToIndex(id);
        await ((_a = this.storageEngine) === null || _a === void 0 ? void 0 : _a.upsert(this.buildId(id), this.structurize(data)));
        if (this.boundObject)
            return this;
        const channel = await ((_b = this.storageEngine) === null || _b === void 0 ? void 0 : _b.get(this.buildId(id)));
        if (channel)
            return new ChannelCache(this.storageEngine, this.channelMap, this.permissionOverwrites.bindChannel(channel.id), this.recipients, this.rain, channel);
        else
            return this;
    }
async update ( id , data ) { var _a , _b ; if ( this . boundObject ) { this . bindObject ( data ) ; } if ( data . guild_id ) { await this . channelMap . update ( data . guild_id , [ data . id ] ) ; } else if ( data . recipients ) { if ( data . recipients [ 0 ] ) { await this . channelMap . update ( data . recipients [ 0 ] . id , [ data . id ] , "user" ) ; } } if ( data . permission_overwrites ) { for ( const overwrite of data . permission_overwrites ) { await this . permissionOverwrites . update ( overwrite . id , id , overwrite ) ; } } delete data . permission_overwrites ; delete data . recipients ; await this . addToIndex ( id ) ; await ( ( _a = this . storageEngine ) === null || _a === void 0 ? void 0 : _a . upsert ( this . buildId ( id ) , this . structurize ( data ) ) ) ; if ( this . boundObject ) return this ; const channel = await ( ( _b = this . storageEngine ) === null || _b === void 0 ? void 0 : _b . get ( this . buildId ( id ) ) ) ; if ( channel ) return new ChannelCache ( this . storageEngine , this . channelMap , this . permissionOverwrites . bindChannel ( channel . id ) , this . recipients , this . rain , channel ) ; else return this ; }
Upsert a channel into the cache
 @param id id of the channel
 @param data data to insert
Upsert a channel into the cache @param id id of the channel @param data data to insert
//using bindobject() to assure the data of the class is valid