import { container } from '@sapphire/framework'
import type { PrivateThreadChannel, Snowflake } from 'discord.js'
import { ChannelType } from 'discord.js'
/**
* Attempts to fetch a {@link PrivateThreadChannel} from the provided channelId
*/
export async function getPrivateThreadChannel(channelId: Snowflake): Promise<PrivateThreadChannel> {
const channel = await container.client.channels.fetch(channelId)
if (channel?.type === ChannelType.PrivateThread) {
return channel
}
throw new Error('channelId is not a Private Thread Channel')
}
import { container } from '@sapphire/framework'
import type { PrivateThreadChannel, Snowflake } from 'discord.js'
import { ChannelType } from 'discord.js'
/**
* Attempts to fetch a {@link PrivateThreadChannel} from the provided channelId
*/
export async function getPrivateThreadChannel(channelId: Snowflake): Promise<PrivateThreadChannel> {
const channel = await container.client.channels.fetch(channelId)
if (channel?.type === ChannelType.PrivateThread) {
return channel
}
throw new Error('channelId is not a Private Thread Channel')
}