mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-27 11:15:02 +00:00
channel typings
Signed-off-by: GitHub <noreply@github.com>
This commit is contained in:
parent
c33a216857
commit
8347095fa0
15 changed files with 91 additions and 103 deletions
|
@ -1,6 +1,5 @@
|
|||
import { Channel, DMChannel } from "discord.js";
|
||||
import { ChannelTypeStrings } from "src/types";
|
||||
import { Channel, ChannelType, DMChannel } from "discord.js";
|
||||
|
||||
export function isDmChannel(channel: Channel): channel is DMChannel {
|
||||
return channel.type === ChannelTypeStrings.DM || channel.type === ChannelTypeStrings.GROUP;
|
||||
return channel.isDMBased();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Channel, GuildChannel } from "discord.js";
|
||||
import { Channel, GuildBasedChannel, GuildChannel } from "discord.js";
|
||||
|
||||
export function isGuildChannel(channel: Channel): channel is GuildChannel {
|
||||
return channel.type.startsWith("GUILD_");
|
||||
export function isGuildChannel(channel: Channel): channel is GuildBasedChannel {
|
||||
return channel.type.toString().startsWith("GUILD_");
|
||||
}
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
import { AnyThreadChannel, Channel, ChannelType } from "discord.js";
|
||||
import { ChannelTypeStrings } from "src/types";
|
||||
|
||||
export function isThreadChannel(channel: Channel): channel is AnyThreadChannel {
|
||||
return (
|
||||
channel.type === ChannelType.PublicThread ||
|
||||
channel.type === ChannelType.PrivateThread ||
|
||||
channel.type === ChannelType.AnnouncementThread
|
||||
);
|
||||
return channel.isThread();
|
||||
}
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
import { ChannelType } from "discord-api-types/v9";
|
||||
import { CategoryChannel, Channel } from "discord.js";
|
||||
import { ChannelTypes } from "discord.js/typings/enums";
|
||||
import { ChannelTypeStrings } from "src/types";
|
||||
import { isDmChannel } from "./isDmChannel";
|
||||
import { isGuildChannel } from "./isGuildChannel";
|
||||
import { isThreadChannel } from "./isThreadChannel";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue