Update to discord.js v13.8.0, adding support for text-in-voice

This commit is contained in:
Dragory 2022-06-13 21:19:56 +03:00
parent ba78103807
commit b05fbe1d04
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
32 changed files with 151 additions and 149 deletions

View file

@ -1,4 +1,4 @@
import { Channel, Message, NewsChannel, TextChannel, ThreadChannel } from "discord.js";
import { Channel, GuildTextBasedChannel, Message, NewsChannel, TextChannel, ThreadChannel } from "discord.js";
import humanizeDuration from "humanize-duration";
import { GuildPluginData } from "knub";
import moment from "moment-timezone";
@ -20,7 +20,7 @@ const MAX_REPEAT_UNTIL = moment.utc().add(100, "years");
export async function actualPostCmd(
pluginData: GuildPluginData<PostPluginType>,
msg: Message,
targetChannel: Channel,
targetChannel: GuildTextBasedChannel,
content: StrictMessageContent,
opts: {
"enable-mentions"?: boolean;
@ -30,12 +30,8 @@ export async function actualPostCmd(
"repeat-times"?: number;
} = {},
) {
if (
!(targetChannel instanceof TextChannel) &&
!(targetChannel instanceof NewsChannel) &&
!(targetChannel instanceof ThreadChannel)
) {
msg.channel.send(errorMessage("Specified channel is not a text channel, announcement channel, or thread"));
if (!targetChannel.isText()) {
msg.channel.send(errorMessage("Specified channel is not a text-based channel"));
return;
}