Skip to content

Commit

Permalink
fix: capture presence status
Browse files Browse the repository at this point in the history
  • Loading branch information
willgarrett64 committed Jul 20, 2022
1 parent 37a46a0 commit 898669b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/network-bot/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ export class NetworkBot {
// Update member counts via channels
this.log.info('Updating member counts')
const guild = this.client.guilds.resolve(GlobalConfig.guildId)
const guildMembers = await guild?.members.fetch()
const guildMembersOnline = guildMembers?.filter(m => !m.user.bot && m.presence !== null)
const guildMembers = await guild?.members.fetch({ withPresences: true })
// eslint-disable-next-line max-len
const guildMembersOnline = guildMembers?.filter(m => !m.user.bot && m.presence !== null && m.presence.status !== 'offline')
const totalChannel = guild?.channels.resolve(GlobalConfig.membersTotalChannelId)
const onlineChannel = guild?.channels.resolve(GlobalConfig.membersOnlineChannelId)
const totalCount = guildMembers ? guildMembers.size : 0
Expand Down

0 comments on commit 898669b

Please sign in to comment.