diff --git a/client/lib/discord-types.ts b/client/lib/discord-types.ts new file mode 100644 index 00000000..3fe7f5e4 --- /dev/null +++ b/client/lib/discord-types.ts @@ -0,0 +1,46 @@ +export interface DiscordUser { + id: string; + username: string; + avatar?: string | null; + email?: string | null; + discriminator?: string; +} + +export interface DiscordSDKUser { + id: string; + username: string; + discriminator?: string; + avatar?: string | null; + email?: string | null; + verified?: boolean; + bot?: boolean; + system?: boolean; + mfa_enabled?: boolean; + public_flags?: number; +} + +export interface DiscordSDK { + ready: () => Promise; + user: { + getMe: () => Promise; + }; + commands?: { + authorize: (options: { + client_id: string; + response_type: string; + scope: string[]; + }) => Promise<{ code: string }>; + getChannel: (id: string) => Promise; + }; + subscribe?: ( + event: string, + callback: (data: any) => void, + ) => () => void; +} + +declare global { + interface Window { + DiscordSDK?: DiscordSDK; + discordSdkReady?: boolean; + } +}