Rework bot function #13
@ -2,11 +2,15 @@ import { GuildBasedChannel, GuildTextBasedChannel, PermissionsBitField } from "d
|
|||||||
import client from "../client";
|
import client from "../client";
|
||||||
|
|
||||||
export async function getGuildChannel(guildID: string, channelID: string): Promise<GuildBasedChannel | null> {
|
export async function getGuildChannel(guildID: string, channelID: string): Promise<GuildBasedChannel | null> {
|
||||||
const guild = await client.guilds.fetch(guildID);
|
try {
|
||||||
if (!guild) return null;
|
const guild = await client.guilds.fetch(guildID);
|
||||||
|
if (!guild) return null;
|
||||||
|
|
||||||
const channel = await guild.channels.fetch(channelID);
|
const channel = await guild.channels.fetch(channelID);
|
||||||
return channel;
|
return channel;
|
||||||
|
} catch (_error) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getChannelPermission(channel: GuildTextBasedChannel): Promise<Readonly<PermissionsBitField> | null> {
|
export async function getChannelPermission(channel: GuildTextBasedChannel): Promise<Readonly<PermissionsBitField> | null> {
|
||||||
|
Loading…
Reference in New Issue
Block a user