tyler is bae <3

This commit is contained in:
Skillz4Killz
2021-06-17 16:38:47 +00:00
committed by GitHub
parent 482a62f0e8
commit db94a659b7
2 changed files with 20 additions and 8 deletions
@@ -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));
}