fix: bad channel.thread handling

This commit is contained in:
Skillz4Killz
2021-06-18 15:47:34 +00:00
committed by GitHub
parent 72f0836b7b
commit 5e4efd0f37
9 changed files with 53 additions and 44 deletions
@@ -0,0 +1,21 @@
import { rest } from "../../../rest/rest.ts";
import { ModifyThread } from "../../../types/channels/threads/modify_thread.ts";
import { endpoints } from "../../../util/constants.ts";
import { channelToThread } from "../../../util/transformers/channel_to_thread.ts";
import { snakelize } from "../../../util/utils.ts";
/** Update a thread's settings. Requires the `MANAGE_CHANNELS` permission for the guild. */
export async function editThread(threadId: bigint, options: ModifyThread, reason?: string) {
// const thread = await cacheHandlers.get("threads", threadId);
const result = await rest.runMethod(
"patch",
endpoints.CHANNEL_BASE(threadId),
snakelize({
...options,
reason,
})
);
return channelToThread(result);
}