Docs/Advanced/TypeScript

TypeScript

Type-safe usage patterns and utility types.

The discordforge-sdk package is written in TypeScript and ships with complete type definitions for all API responses and options.

Importing Types

1import type {
2 ClientOptions,
3 BotStats,
4 VoteMetadata,
5 BotInfo,
6 SyncCommand,
7 AutoPosterOptions,
8} from "discordforge-sdk";

Response Types

1// Vote check response
2interface VoteMetadata {
3 hasVoted: boolean;
4 votedAt?: string;
5 nextVoteAt?: string;
6}
7 
8// Bot public info
9interface BotInfo {
10 id: string;
11 name: string;
12 voteCount: number;
13 serverCount: number;
14 [key: string]: any;
15}
16 
17// Stats payload
18interface BotStats {
19 serverCount: number;
20 shardCount?: number;
21 userCount?: number;
22 voiceConnections?: number;
23}
24 
25// Sync command (custom or Discord API format)
26type SyncCommand = CustomCommand | DiscordCommand;