Skip to content

Commit

Permalink
feat: allow setting activity type
Browse files Browse the repository at this point in the history
  • Loading branch information
NextFire committed Aug 19, 2024
1 parent c68f9dd commit 08c36d0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { DiscordIPC, PacketIPCEvent } from "./conn.ts";
import type {
Activity,
ActivityType,
ApplicationPayload,
AuthenticateResponsePayload,
ChannelPayload,
Expand Down Expand Up @@ -95,7 +96,7 @@ export class Client {
*/
setActivity(activity?: Activity) {
return this.ipc!.sendCommand<
Activity & { application_id: string; type: number }
Activity & { application_id: string; type: ActivityType }
>(
"SET_ACTIVITY",
{
Expand Down
10 changes: 10 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// deno-lint-ignore-file camelcase

export interface Activity {
type?: ActivityType;
details?: string;
state?: string;
assets?: {
Expand Down Expand Up @@ -28,6 +29,15 @@ export interface Activity {
}[];
}

export enum ActivityType {
PLAYING,
STREAMING,
LISTENING,
WATCHING,
CUSTOM,
COMPETING,
}

export enum OpCode {
HANDSHAKE,
FRAME,
Expand Down

0 comments on commit 08c36d0

Please sign in to comment.