Skip to content

Commit

Permalink
fix(Presence): cannot receive invisible status (#799)
Browse files Browse the repository at this point in the history
  • Loading branch information
advaith1 committed Jul 28, 2023
1 parent ae8503f commit 1071d24
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 24 deletions.
13 changes: 9 additions & 4 deletions deno/payloads/v10/gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export interface GatewayPresenceUpdate {
/**
* Either "idle", "dnd", "online", or "offline"
*/
status?: PresenceUpdateStatus;
status?: PresenceUpdateReceiveStatus;
/**
* User's current activities
*
Expand All @@ -94,6 +94,9 @@ export interface GatewayPresenceUpdate {
client_status?: GatewayPresenceClientStatus;
}

/**
* https://discord.com/developers/docs/topics/gateway-events#update-presence-status-types
*/
export enum PresenceUpdateStatus {
Online = 'online',
DoNotDisturb = 'dnd',
Expand All @@ -105,22 +108,24 @@ export enum PresenceUpdateStatus {
Offline = 'offline',
}

export type PresenceUpdateReceiveStatus = Exclude<PresenceUpdateStatus, PresenceUpdateStatus.Invisible>;

/**
* https://discord.com/developers/docs/topics/gateway-events#client-status-object
*/
export interface GatewayPresenceClientStatus {
/**
* The user's status set for an active desktop (Windows, Linux, Mac) application session
*/
desktop?: PresenceUpdateStatus;
desktop?: PresenceUpdateReceiveStatus;
/**
* The user's status set for an active mobile (iOS, Android) application session
*/
mobile?: PresenceUpdateStatus;
mobile?: PresenceUpdateReceiveStatus;
/**
* The user's status set for an active web (browser, bot account) application session
*/
web?: PresenceUpdateStatus;
web?: PresenceUpdateReceiveStatus;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions deno/payloads/v10/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import type { Permissions, Snowflake } from '../../globals.ts';
import type { APIEmoji, APIPartialEmoji } from './emoji.ts';
import type { PresenceUpdateStatus } from './gateway.ts';
import type { PresenceUpdateReceiveStatus } from './gateway.ts';
import type { OAuth2Scopes } from './oauth2.ts';
import type { APIRole } from './permissions.ts';
import type { APISticker } from './sticker.ts';
Expand Down Expand Up @@ -903,7 +903,7 @@ export interface APIGuildWidgetMember {
username: string;
discriminator: string;
avatar: string | null;
status: PresenceUpdateStatus;
status: PresenceUpdateReceiveStatus;
activity?: { name: string };
avatar_url: string;
}
Expand Down
13 changes: 9 additions & 4 deletions deno/payloads/v9/gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export interface GatewayPresenceUpdate {
/**
* Either "idle", "dnd", "online", or "offline"
*/
status?: PresenceUpdateStatus;
status?: PresenceUpdateReceiveStatus;
/**
* User's current activities
*
Expand All @@ -94,6 +94,9 @@ export interface GatewayPresenceUpdate {
client_status?: GatewayPresenceClientStatus;
}

/**
* https://discord.com/developers/docs/topics/gateway-events#update-presence-status-types
*/
export enum PresenceUpdateStatus {
Online = 'online',
DoNotDisturb = 'dnd',
Expand All @@ -105,22 +108,24 @@ export enum PresenceUpdateStatus {
Offline = 'offline',
}

export type PresenceUpdateReceiveStatus = Exclude<PresenceUpdateStatus, PresenceUpdateStatus.Invisible>;

/**
* https://discord.com/developers/docs/topics/gateway-events#client-status-object
*/
export interface GatewayPresenceClientStatus {
/**
* The user's status set for an active desktop (Windows, Linux, Mac) application session
*/
desktop?: PresenceUpdateStatus;
desktop?: PresenceUpdateReceiveStatus;
/**
* The user's status set for an active mobile (iOS, Android) application session
*/
mobile?: PresenceUpdateStatus;
mobile?: PresenceUpdateReceiveStatus;
/**
* The user's status set for an active web (browser, bot account) application session
*/
web?: PresenceUpdateStatus;
web?: PresenceUpdateReceiveStatus;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions deno/payloads/v9/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import type { Permissions, Snowflake } from '../../globals.ts';
import type { APIEmoji, APIPartialEmoji } from './emoji.ts';
import type { PresenceUpdateStatus } from './gateway.ts';
import type { PresenceUpdateReceiveStatus } from './gateway.ts';
import type { OAuth2Scopes } from './oauth2.ts';
import type { APIRole } from './permissions.ts';
import type { APISticker } from './sticker.ts';
Expand Down Expand Up @@ -895,7 +895,7 @@ export interface APIGuildWidgetMember {
username: string;
discriminator: string;
avatar: string | null;
status: PresenceUpdateStatus;
status: PresenceUpdateReceiveStatus;
activity?: { name: string };
avatar_url: string;
}
Expand Down
13 changes: 9 additions & 4 deletions payloads/v10/gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export interface GatewayPresenceUpdate {
/**
* Either "idle", "dnd", "online", or "offline"
*/
status?: PresenceUpdateStatus;
status?: PresenceUpdateReceiveStatus;
/**
* User's current activities
*
Expand All @@ -94,6 +94,9 @@ export interface GatewayPresenceUpdate {
client_status?: GatewayPresenceClientStatus;
}

/**
* https://discord.com/developers/docs/topics/gateway-events#update-presence-status-types
*/
export enum PresenceUpdateStatus {
Online = 'online',
DoNotDisturb = 'dnd',
Expand All @@ -105,22 +108,24 @@ export enum PresenceUpdateStatus {
Offline = 'offline',
}

export type PresenceUpdateReceiveStatus = Exclude<PresenceUpdateStatus, PresenceUpdateStatus.Invisible>;

/**
* https://discord.com/developers/docs/topics/gateway-events#client-status-object
*/
export interface GatewayPresenceClientStatus {
/**
* The user's status set for an active desktop (Windows, Linux, Mac) application session
*/
desktop?: PresenceUpdateStatus;
desktop?: PresenceUpdateReceiveStatus;
/**
* The user's status set for an active mobile (iOS, Android) application session
*/
mobile?: PresenceUpdateStatus;
mobile?: PresenceUpdateReceiveStatus;
/**
* The user's status set for an active web (browser, bot account) application session
*/
web?: PresenceUpdateStatus;
web?: PresenceUpdateReceiveStatus;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions payloads/v10/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import type { Permissions, Snowflake } from '../../globals';
import type { APIEmoji, APIPartialEmoji } from './emoji';
import type { PresenceUpdateStatus } from './gateway';
import type { PresenceUpdateReceiveStatus } from './gateway';
import type { OAuth2Scopes } from './oauth2';
import type { APIRole } from './permissions';
import type { APISticker } from './sticker';
Expand Down Expand Up @@ -903,7 +903,7 @@ export interface APIGuildWidgetMember {
username: string;
discriminator: string;
avatar: string | null;
status: PresenceUpdateStatus;
status: PresenceUpdateReceiveStatus;
activity?: { name: string };
avatar_url: string;
}
Expand Down
13 changes: 9 additions & 4 deletions payloads/v9/gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export interface GatewayPresenceUpdate {
/**
* Either "idle", "dnd", "online", or "offline"
*/
status?: PresenceUpdateStatus;
status?: PresenceUpdateReceiveStatus;
/**
* User's current activities
*
Expand All @@ -94,6 +94,9 @@ export interface GatewayPresenceUpdate {
client_status?: GatewayPresenceClientStatus;
}

/**
* https://discord.com/developers/docs/topics/gateway-events#update-presence-status-types
*/
export enum PresenceUpdateStatus {
Online = 'online',
DoNotDisturb = 'dnd',
Expand All @@ -105,22 +108,24 @@ export enum PresenceUpdateStatus {
Offline = 'offline',
}

export type PresenceUpdateReceiveStatus = Exclude<PresenceUpdateStatus, PresenceUpdateStatus.Invisible>;

/**
* https://discord.com/developers/docs/topics/gateway-events#client-status-object
*/
export interface GatewayPresenceClientStatus {
/**
* The user's status set for an active desktop (Windows, Linux, Mac) application session
*/
desktop?: PresenceUpdateStatus;
desktop?: PresenceUpdateReceiveStatus;
/**
* The user's status set for an active mobile (iOS, Android) application session
*/
mobile?: PresenceUpdateStatus;
mobile?: PresenceUpdateReceiveStatus;
/**
* The user's status set for an active web (browser, bot account) application session
*/
web?: PresenceUpdateStatus;
web?: PresenceUpdateReceiveStatus;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions payloads/v9/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import type { Permissions, Snowflake } from '../../globals';
import type { APIEmoji, APIPartialEmoji } from './emoji';
import type { PresenceUpdateStatus } from './gateway';
import type { PresenceUpdateReceiveStatus } from './gateway';
import type { OAuth2Scopes } from './oauth2';
import type { APIRole } from './permissions';
import type { APISticker } from './sticker';
Expand Down Expand Up @@ -895,7 +895,7 @@ export interface APIGuildWidgetMember {
username: string;
discriminator: string;
avatar: string | null;
status: PresenceUpdateStatus;
status: PresenceUpdateReceiveStatus;
activity?: { name: string };
avatar_url: string;
}
Expand Down

1 comment on commit 1071d24

@vercel
Copy link

@vercel vercel bot commented on 1071d24 Jul 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.