Skip to content
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
8 changes: 8 additions & 0 deletions src/structures/Channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ class Channel extends Base {
return this.client.channels.fetch(this.id, true, force);
}

/**
* Indicates whether this channel is text-based.
* @returns {boolean}
*/
isText() {
return 'messages' in this;
}

static create(client, data, guild) {
const Structures = require('../util/Structures');
let channel;
Expand Down
2 changes: 2 additions & 0 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ declare module 'discord.js' {
public type: keyof typeof ChannelType;
public delete(reason?: string): Promise<Channel>;
public fetch(force?: boolean): Promise<Channel>;
public isText(): this is TextChannel | DMChannel | NewsChannel;
public toString(): string;
}

Expand Down Expand Up @@ -800,6 +801,7 @@ declare module 'discord.js' {
options: PermissionOverwriteOption,
reason?: string,
): Promise<this>;
public isText(): this is TextChannel | NewsChannel;
}

export class GuildEmoji extends BaseGuildEmoji {
Expand Down