{!!(mode & IndicatorType.FRIEND) && }
{!!(mode & IndicatorType.SERVER) && }
;
},
handlePresenceUpdate() {
onlineFriends = 0;
const relations = RelationshipStore.getRelationships();
for (const id of Object.keys(relations)) {
const type = relations[id];
// FRIEND relationship type
if (type === 1 && PresenceStore.getStatus(id) !== "offline") {
onlineFriends += 1;
}
}
forceUpdateFriendCount?.();
},
handleGuildUpdate() {
guildCount = GuildStore.getGuildCount();
forceUpdateGuildCount?.();
},
start() {
this.handlePresenceUpdate();
this.handleGuildUpdate();
addServerListElement(ServerListRenderPosition.Above, this.renderIndicator);
FluxDispatcher.subscribe("PRESENCE_UPDATES", this.handlePresenceUpdate);
FluxDispatcher.subscribe("GUILD_CREATE", this.handleGuildUpdate);
FluxDispatcher.subscribe("GUILD_DELETE", this.handleGuildUpdate);
},
stop() {
removeServerListElement(ServerListRenderPosition.Above, this.renderIndicator);
FluxDispatcher.unsubscribe("PRESENCE_UPDATES", this.handlePresenceUpdate);
FluxDispatcher.unsubscribe("GUILD_CREATE", this.handleGuildUpdate);
FluxDispatcher.unsubscribe("GUILD_DELETE", this.handleGuildUpdate);
}
});