Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some typescript mistakes #1097

Merged
merged 4 commits into from
Mar 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 15 additions & 35 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -504,14 +504,17 @@ declare namespace Eris {
(event: "disconnect", listener: (err: Error) => void): T;
(event: "resume", listener: () => void): T;
}
interface StreamEvents<T> extends EventListeners<T> {
(event: "end" | "start", listener: () => void): T;
(event: "error", listener: (err: Error) => void): T;
}
interface VoiceEvents<T> {
(event: "connect" | "end" | "ready" | "start", listener: () => void): T;
(event: "debug" | "warn", listener: (message: string) => void): T;
(event: "error" | "disconnect", listener: (err: Error) => void): T;
(event: "disconnect" | "error", listener: (err?: Error) => void): T;
(event: "pong", listener: (latency: number) => void): T;
(event: "speakingStart", listener: (userID: string) => void): T;
(event: "speakingStop", listener: (userID: string) => void): T;
(event: "end", listener: () => void): T;
(event: "userDisconnect", listener: (userID: string) => void): T;
(event: "speakingStart" | "speakingStop" | "userDisconnect", listener: (userID: string) => void): T;
(event: "unknown", listener: (packet: unknown) => void): T;
}

// Gateway/REST
Expand Down Expand Up @@ -1243,16 +1246,21 @@ declare namespace Eris {
}

export class Client extends EventEmitter {
bot?: boolean;
bot: boolean;
bsian03 marked this conversation as resolved.
Show resolved Hide resolved
channelGuildMap: { [s: string]: string };
gatewayURL?: string;
groupChannels: Collection<GroupChannel>;
guilds: Collection<Guild>;
guildShardMap: { [s: string]: number };
lastConnect: number;
lastReconnectDelay: number;
notes: { [s: string]: string };
options: ClientOptions;
presence: Presence;
privateChannelMap: { [s: string]: string };
privateChannels: Collection<PrivateChannel>;
ready: boolean;
reconnectAttempts: number;
relationships: Collection<Relationship>;
requestHandler: RequestHandler;
shards: ShardManager;
Expand Down Expand Up @@ -1696,35 +1704,6 @@ declare namespace Eris {
removeRecipient(userID: string): Promise<void>;
}

interface DiscoveryMetadata {
guild_id: string;
primary_category_id: number;
keywords: string[] | null;
emoji_discoverability_enabled: boolean;
category_ids: number[];
}

interface DiscoveryOptions {
primaryCategoryID?: string;
keywords?: string[];
emojiDiscoverabilityEnabled?: boolean;
reason?: string;
}

interface DiscoveryCategory {
id: number;
name: {
default: string;
localizations?: { [lang: string]: string };
};
is_primary: boolean;
}

interface DiscoverySubcategoryResponse {
guild_id: string;
category_id: number;
}

export class Guild extends Base {
afkChannelID: string | null;
afkTimeout: number;
Expand Down Expand Up @@ -2278,6 +2257,7 @@ declare namespace Eris {
setSpeaking(value: boolean): void;
setVolume(volume: number): void;
stopPlaying(): void;
on: StreamEvents<this>;
}

export class StoreChannel extends GuildChannel {
Expand Down
2 changes: 1 addition & 1 deletion lib/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const sleep = (ms) => new Promise((res) => setTimeout(res, ms));
/**
* Represents the main Eris client
* @extends EventEmitter
* @prop {Boolean?} bot Whether the bot user belongs to an OAuth2 application
* @prop {Boolean} bot Whether the bot user belongs to an OAuth2 application
* @prop {Object} channelGuildMap Object mapping channel IDs to guild IDs
* @prop {String} gatewayURL The URL for the discord gateway
* @prop {Collection<GroupChannel>} groupChannels Collection of group channels the bot is in (user accounts only)
Expand Down
2 changes: 1 addition & 1 deletion lib/voice/VoiceConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ class VoiceConnection extends EventEmitter {

/**
* Fired when the voice connection starts playing a stream
* @event SharedStream#start
* @event VoiceConnection#start
*/
this.emit("start");

Expand Down