mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-11 04:45:02 +00:00
Fix being unable to !post to announcement channels or threads
This commit is contained in:
parent
ca9ea60082
commit
05df81ddca
5 changed files with 15 additions and 11 deletions
|
@ -1,4 +1,4 @@
|
|||
import { Channel, Message, TextChannel } from "discord.js";
|
||||
import { Channel, Message, NewsChannel, TextChannel, ThreadChannel } from "discord.js";
|
||||
import humanizeDuration from "humanize-duration";
|
||||
import { GuildPluginData } from "knub";
|
||||
import moment from "moment-timezone";
|
||||
|
@ -29,8 +29,12 @@ export async function actualPostCmd(
|
|||
"repeat-times"?: number;
|
||||
} = {},
|
||||
) {
|
||||
if (!(targetChannel instanceof TextChannel)) {
|
||||
msg.channel.send(errorMessage("Channel is not a text channel"));
|
||||
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"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Message, MessageAttachment, MessageOptions, TextChannel } from "discord.js";
|
||||
import { Message, MessageAttachment, MessageOptions, NewsChannel, TextChannel, ThreadChannel } from "discord.js";
|
||||
import fs from "fs";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { downloadFile } from "../../../utils";
|
||||
|
@ -9,7 +9,7 @@ const fsp = fs.promises;
|
|||
|
||||
export async function postMessage(
|
||||
pluginData: GuildPluginData<PostPluginType>,
|
||||
channel: TextChannel,
|
||||
channel: TextChannel | NewsChannel | ThreadChannel,
|
||||
content: MessageOptions,
|
||||
attachments: MessageAttachment[] = [],
|
||||
enableMentions: boolean = false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue