mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 19:28:17 +00:00
tyler is bae <3
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import { cacheHandlers } from "../../../cache.ts";
|
||||
import { rest } from "../../../rest/rest.ts";
|
||||
import { Errors } from "../../../types/discordeno/errors.ts";
|
||||
import { endpoints } from "../../../util/constants.ts";
|
||||
|
||||
/** Adds the bot to the thread. Cannot join an archived thread. */
|
||||
export async function joinThread(threadId: bigint) {
|
||||
const thread = await cacheHandlers.get("threads", threadId);
|
||||
if (thread?.archived) {
|
||||
throw new Error(Errors.CANNOT_ADD_USER_TO_ARCHIVED_THREADS);
|
||||
}
|
||||
|
||||
return await rest.runMethod("put", endpoints.THREAD_ME(threadId));
|
||||
}
|
||||
Reference in New Issue
Block a user