Skip to content

Commit

Permalink
Fix createChannel() typings (#552)
Browse files Browse the repository at this point in the history
  • Loading branch information
Skillz4Killz authored and abalabahaha committed Oct 31, 2019
1 parent 6148a45 commit 1527843
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 7 deletions.
37 changes: 33 additions & 4 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -569,13 +569,38 @@ declare namespace Eris {
public editAFK(afk: boolean): void;
public editStatus(status?: string, game?: GamePresence): void;
public getChannel(channelID: string): AnyChannel;
public createChannel(
guildID: string,
name: string,
): Promise<TextChannel>;
public createChannel(
guildID: string,
name: string,
type: 0,
reason?: string,
parentID?: string,
): Promise<TextChannel>;
public createChannel(
guildID: string,
name: string,
type: 2,
reason?: string,
parentID?: string,
): Promise<VoiceChannel>;
public createChannel(
guildID: string,
name: string,
type: 4,
reason?: string,
parentID?: string,
): Promise<CategoryChannel>;
public createChannel(
guildID: string,
name: string,
type?: number,
reason?: string,
parentID?: string,
): Promise<AnyGuildChannel>;
): Promise<unknown>;
public editChannel(channelID: string, options: {
name?: string,
icon?: string,
Expand Down Expand Up @@ -1073,7 +1098,11 @@ declare namespace Eris {
public constructor(data: BaseData, client: Client);
public fetchAllMembers(): void;
public dynamicIconURL(format: string, size: number): string;
public createChannel(name: string, type: string, parentID?: string): Promise<AnyGuildChannel>;
public createChannel(name: string): Promise<TextChannel>;
public createChannel(name: string, type: 0, reason?: string, parentID?: string): Promise<TextChannel>;
public createChannel(name: string, type: 2, reason?: string, parentID?: string): Promise<VoiceChannel>;
public createChannel(name: string, type: 4, reason?: string, parentID?: string): Promise<CategoryChannel>;
public createChannel(name: string, type?: number, reason?: string, parentID?: string): Promise<unknown>;
public createEmoji(
options: { name: string, image: string, roles?: string[] },
reason?: string,
Expand Down Expand Up @@ -1176,7 +1205,7 @@ declare namespace Eris {
}

export class CategoryChannel extends GuildChannel {
public channels?: Collection<AnyGuildChannel>;
public channels: Collection<TextChannel | VoiceChannel>;
}

export class TextChannel extends GuildChannel implements Textable, Invitable {
Expand Down Expand Up @@ -1320,7 +1349,7 @@ declare namespace Eris {
public content: string;
public cleanContent?: string;
public roleMentions: string[];
public channelMentions?: string[];
public channelMentions: string[];
public editedTimestamp?: number;
public tts: boolean;
public mentionEveryone: boolean;
Expand Down
2 changes: 1 addition & 1 deletion lib/structures/CategoryChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const GuildChannel = require("./GuildChannel");
* @prop {Number} position The position of the channel
* @prop {Boolean} nsfw Whether the channel is an NSFW channel or not
* @prop {Collection<PermissionOverwrite>} permissionOverwrites Collection of PermissionOverwrites in this channel
* @prop {Collection<GuildChannel>?} channels A collection of guild channels that are part of this category
* @prop {Collection<GuildChannel>} channels A collection of guild channels that are part of this category
*/
class CategoryChannel extends GuildChannel {
constructor(data, guild) {
Expand Down
2 changes: 1 addition & 1 deletion lib/structures/Guild.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class Guild extends Base {
/**
* Create a channel in the guild
* @arg {String} name The name of the channel
* @arg {String} [type=0] The type of the channel, either 0 (text), 2 (voice), or 4 (category)
* @arg {Number} [type=0] The type of the channel, either 0 (text), 2 (voice), or 4 (category)
* @arg {String} [reason] The reason to be displayed in audit logs
* @arg {Object} [options] The properties the channel should have
* @arg {String} [options.topic] The topic of the channel (text channels only)
Expand Down
2 changes: 1 addition & 1 deletion lib/structures/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const User = require("./User");
* @prop {String} content Message content
* @prop {String?} cleanContent Message content with mentions replaced by names, and @everyone/@here escaped
* @prop {String[]} roleMentions Array of mentioned roles' ids
* @prop {String[]?} channelMentions Array of mentions channels' ids
* @prop {String[]} channelMentions Array of mentions channels' ids
* @prop {Number?} editedTimestamp Timestamp of latest message edit
* @prop {Boolean} tts Whether to play the message using TTS or not
* @prop {Boolean} mentionEveryone Whether the message mentions everyone/here or not
Expand Down

0 comments on commit 1527843

Please sign in to comment.