dist/cache/PresenceCache.js
/**
     * Upsert the presence of a user.
     *
     * **This function automatically removes the guild_id, roles and user of a presence update before saving it**
     * @param id id of the user the presence belongs to
     * @param data updated presence data of the user
     * @returns returns a bound presence cache
     */
Upsert the presence of a user.
This function automatically removes the guild_id, roles and user of a presence update before saving it
@param id id of the user the presence belongs to
@param data updated presence data of the user
@returns returns a bound presence cache
Upsert the presence of a user . This function automatically removes the guild_id roles and user of a presence update before saving it @param id id of the user the presence belongs to @param data updated presence data of the user @returns returns a bound presence cache
async update(id, data) {
        var _a;
        if (this.boundObject) {
            this.bindObject(data);
        }
        if (data.guild_id) {
            delete data.guild_id;
        }
        if (data.roles) {
            delete data.roles;
        }
        if (data.user) {
            await this.users.update(data.user.id, data.user);
            delete data.user;
        }
        await ((_a = this.storageEngine) === null || _a === void 0 ? void 0 : _a.upsert(this.buildId(id), this.structurize(data)));
        if (this.boundObject)
            return this;
        return new PresenceCache(this.storageEngine, this.users, this.rain, data);
    }
async update ( id , data ) { var _a ; if ( this . boundObject ) { this . bindObject ( data ) ; } if ( data . guild_id ) { delete data . guild_id ; } if ( data . roles ) { delete data . roles ; } if ( data . user ) { await this . users . update ( data . user . id , data . user ) ; delete data . user ; } await ( ( _a = this . storageEngine ) === null || _a === void 0 ? void 0 : _a . upsert ( this . buildId ( id ) , this . structurize ( data ) ) ) ; if ( this . boundObject ) return this ; return new PresenceCache ( this . storageEngine , this . users , this . rain , data ) ; }
Upsert the presence of a user.
Upsert the presence of a user .
// @ts-ignore It MUST? Watch me. Remove this ignore. It's funny. // @ts-ignore // @ts-ignore