mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
fix: remove deleteThread
This commit is contained in:
@@ -586,7 +586,6 @@ export interface Helpers {
|
||||
upsertApplicationCommands: typeof helpers.upsertApplicationCommands;
|
||||
validDiscoveryTerm: typeof helpers.validDiscoveryTerm;
|
||||
addToThread: typeof helpers.addToThread;
|
||||
deleteThread: typeof helpers.deleteThread;
|
||||
editThread: typeof helpers.editThread;
|
||||
getActiveThreads: typeof helpers.getActiveThreads;
|
||||
getArchivedThreads: typeof helpers.getArchivedThreads;
|
||||
@@ -755,7 +754,6 @@ export function createBaseHelpers(options: Partial<Helpers>) {
|
||||
upsertApplicationCommands: options.upsertApplicationCommands || helpers.upsertApplicationCommands,
|
||||
validDiscoveryTerm: options.validDiscoveryTerm || helpers.validDiscoveryTerm,
|
||||
addToThread: options.addToThread || helpers.addToThread,
|
||||
deleteThread: options.deleteThread || helpers.deleteThread,
|
||||
editThread: options.editThread || helpers.editThread,
|
||||
getActiveThreads: options.getActiveThreads || helpers.getActiveThreads,
|
||||
getArchivedThreads: options.getArchivedThreads || helpers.getArchivedThreads,
|
||||
|
||||
@@ -1,8 +1,19 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { Channel } from "../../types/channels/channel.ts";
|
||||
|
||||
/** Delete a channel in your server. Bot needs MANAGE_CHANNEL permissions in the server. */
|
||||
/** Delete a channel in your server. Bot needs MANAGE_CHANNEL permissions in the server. Bot needs MANAGE_THREADS permissions in the server if deleting thread. */
|
||||
export async function deleteChannel(bot: Bot, channelId: bigint, reason?: string) {
|
||||
return await bot.rest.runMethod<undefined>(bot.rest, "delete", bot.constants.endpoints.CHANNEL_BASE(channelId), {
|
||||
reason,
|
||||
const result = await bot.rest.runMethod<Channel>(
|
||||
bot.rest,
|
||||
"delete",
|
||||
bot.constants.endpoints.CHANNEL_BASE(channelId),
|
||||
{
|
||||
reason,
|
||||
}
|
||||
);
|
||||
|
||||
return bot.transformers.channel(bot, {
|
||||
channel: result,
|
||||
guildId: result.guild_id ? bot.transformers.snowflake(result.guild_id) : undefined,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
import type { Bot } from "../../../bot.ts";
|
||||
|
||||
/** Delete a thread in your server. Bot needs MANAGE_THREADS permissions in the server. */
|
||||
export async function deleteThread(bot: Bot, threadId: bigint, reason?: string) {
|
||||
return await bot.rest.runMethod<undefined>(bot.rest, "delete", bot.constants.endpoints.CHANNEL_BASE(threadId), {
|
||||
reason,
|
||||
});
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
export * from "./addToThread.ts";
|
||||
export * from "./deleteThread.ts";
|
||||
export * from "./editThread.ts";
|
||||
export * from "./getActiveThreads.ts";
|
||||
export * from "./getArchivedThreads.ts";
|
||||
|
||||
@@ -159,7 +159,6 @@ export * from "./channels/getStageInstance.ts";
|
||||
export * from "./channels/deleteStageInstance.ts";
|
||||
export * from "./voice/connectToVoiceChannel.ts";
|
||||
export * from "./channels/threads/addToThread.ts";
|
||||
export * from "./channels/threads/deleteThread.ts";
|
||||
export * from "./channels/threads/editThread.ts";
|
||||
export * from "./channels/threads/getActiveThreads.ts";
|
||||
export * from "./channels/threads/getArchivedThreads.ts";
|
||||
|
||||
@@ -54,6 +54,6 @@ Deno.test("[thread] Start a thread", async (t) => {
|
||||
});
|
||||
|
||||
await t.step("[thread] Delete a thread", async () => {
|
||||
await bot.helpers.deleteThread(thread.id);
|
||||
await bot.helpers.deleteChannel(thread.id);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user