Forum channel (#2160)

* [WIP] Forum Channels

* Delete package-lock.json

🤕

* Add Message typings and fix createForumPost

* Remove unnecessary comment

* Update helpers/channels/forums/createForumPost.ts

Use transformer

Co-authored-by: LTS20050703 <87189679+lts20050703@users.noreply.github.com>

* Update helpers/channels/forums/createForumPost.ts

Use Pascal case for `CreateForumPostWithMessage`

Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>

* Update helpers/channels/forums/createForumPost.ts

Use Pascal case for `CreateForumPostWithMessage`

Co-authored-by: LTS20050703 <87189679+lts20050703@users.noreply.github.com>

* Remove unneeded types

* Revert Review and Edit it

* Add reason

Co-authored-by: meister03 <root@_HOSTNAME_>
Co-authored-by: LTS20050703 <87189679+lts20050703@users.noreply.github.com>
Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>
This commit is contained in:
meister03
2022-05-13 10:28:53 -04:00
committed by GitHub
co-authored by LTS20050703 Skillz4Killz meister03
parent 749dafd1ce
commit 7caab52b68
12 changed files with 105 additions and 0 deletions
@@ -0,0 +1,16 @@
import { BotWithCache } from "../../../deps.ts";
import { requireBotChannelPermissions } from "../../permissions.ts";
export default function createForumPosts(bot: BotWithCache) {
const createForumPostsOld = bot.helpers.createForumPosts;
bot.helpers.createForumPosts= async function (channelId, options) {
const channel = bot.channels.get(channelId);
if (channel) {
await requireBotChannelPermissions(bot, channel, ["SEND_MESSAGES"]);
}
return await createForumPostsOld(channelId, options);
};
}
@@ -0,0 +1,6 @@
import { BotWithCache } from "../../../deps.ts";
import { createForumPost } from "./createForumPost.ts";
export default function setupThreadPermChecks(bot: BotWithCache) {
createForumPost(bot);
}
+2
View File
@@ -1,5 +1,6 @@
import { BotWithCache } from "../../deps.ts";
import setupThreadPermChecks from "./threads/mod.ts";
import setupForumPermChecks from "./forums/mod.ts";
import setupStagePermChecks from "./stage.ts";
import deleteChannel from "./deleteChannel.ts";
import deleteChannelOverwrite from "./deleteChannelOverwrite.ts";
@@ -11,6 +12,7 @@ import swapChannels from "./swapChannels.ts";
export default function setupChannelPermChecks(bot: BotWithCache) {
setupThreadPermChecks(bot);
setupForumPermChecks(bot);
setupStagePermChecks(bot);
deleteChannel(bot);
deleteChannelOverwrite(bot);
@@ -19,6 +19,7 @@ export function sendMessage(bot: BotWithCache) {
[
ChannelTypes.GuildCategory,
ChannelTypes.GuildStageVoice,
ChannelTypes.GuildForum,
].includes(channel.type)
) {
throw new Error(