#'offline' presence updates to 'online'

1 messages Β· Page 1 of 1 (latest)

stuck swallow
#

Hey, when attempting to use the 'offline' presence it for some reason updates to 'online' instead?

      connecting: (shard) => {
        shard.makePresence = async () => {
          const presence: DiscordUpdatePresence = {
            status: 'offline',
            activities: [
              {
                state: 'Appy Custom Bot123',
                name: 'name',
                type: ActivityTypes.Playing,
              },
            ],
            afk: false,
            since: 0,
          }
          return presence
        }
      },
valid gust
#

i think invisible is what you send, offline is what you receive, cant send it afaik

stuck swallow
#

ffs yes that works, i tried this earlier and got mixed results, i think i just wasn't waiting long enough for the status to change...

#

thank you, just fyi, dd doesnt "officially" support "invisible" as its not included in the enum

/** https://discord.com/developers/docs/events/gateway-events#update-presence-status-types */
export declare enum PresenceStatus {
    online = 0,
    dnd = 1,
    idle = 2,
    offline = 3
}
#

i dont know what offline is for, but if its needed to keep it then would something like this be okay for the "fix"? if so, i can submit pr now

    // if the status is set to offline change it to invisible
    const presence = await this.makePresence()
    if (presence?.status === 'offline') presence.status = 'invisible'

    this.send(
      {
        op: GatewayOpcodes.Identify,
        d: {
          token: `Bot ${this.gatewayConfig.token}`,
          compress: this.gatewayConfig.compress,
          properties: this.gatewayConfig.properties,
          intents: this.gatewayConfig.intents,
          shard: [this.id, this.gatewayConfig.totalShards],
          presence,
        },
      },
      true,
    )
/** https://discord.com/developers/docs/events/gateway-events#update-presence-status-types */
export enum PresenceStatus {
  online,
  dnd,
  idle,
  invisible, // added invisible
  offline,
}
valid gust
#

have to check where we need it but yes according to community maintained docs, you send invisible and receive offline

flat gyro
valid gust
#

do we need the offline at all?

flat gyro
#

if someone reads it

valid gust
#

ah

#

why dont we just add it in here instead

flat gyro
#

?

valid gust
#

assuming it's the only place where someone would get it from

valid gust
flat gyro
valid gust
#

theres this

#

and we could do like this but idk

#

no idea what the reverseStatusTypes is doing there

flat gyro
valid gust
#

ig it got replaced by that PresenceStatus

#

i wouldnt want to have both invisible and offline in here but due to discord having it, im fine with it lol

valid gust
#

otherwise the pr looks good

#

while i get that sending offline is pointless, idk if dd should modify what the user sends

#

ok i think this would be better

flat gyro
valid gust
#

yea well im not getting intellisense with this

flat gyro
#

oh bc it is keyof, didn't see that, then you are good

#

(for the number thing)

flat gyro
#

Omit is for objects
Exlcude for unions

valid gust
#

yea works

#

would do that instead then

#

and have both invisible and offline in type

valid gust
#

his fork is cursed

#

even after all that merge commits it wasnt up to date 😭 (or for some reason it didnt show some code there in search)

stuck swallow
#

anyway, thank you for your work guys, much appreciated πŸ™‚

#

20 commits??!?!

flat gyro
stuck swallow
#

its a new branch i made though, not sure why its included all previous ones too since i got rid of any changes that were not part of dd, am i just stupid πŸ˜…

flat gyro
#

and from what branch

stuck swallow
#
git stash -> get rid of any changes i dont want
git checkout main
git pull
git checkout -b branchname```
#

did this after syncing my repo with dd

flat gyro
#

assuming your main was the same as the dd one then idk

stuck swallow
#

same not sure, sorry if it caused any issues though πŸ˜…

flat gyro
#

nha it is fine (i think)

stuck swallow
#

i did check the chanegs when i made the pr and it seemed okay