feat(threads): thread and forum API, admin, schemas and docs (#3251)

This commit is contained in:
Hampus authored and GitHub committed 2026-10-07 15:25:12 +02:00
1 parent 5f4295e399
commit 3f4160b138
495 files changed
+39232 -1215

No files matched your search

@@ -41,3 +41,30 @@ describe('canAuthorizeBotInvite', () => {
).toBe(true);
});
});
describe('bot invite permission mask', () => {
const threadBit = 1n << 38n;
it('drops bits outside the default mask', () => {
expect(normalizeBotInvitePermissions(threadBit | Permissions.SEND_MESSAGES)).toBe(Permissions.SEND_MESSAGES);
});
it('keeps bits inside a wider mask', () => {
const mask = Permissions.SEND_MESSAGES | threadBit;
expect(normalizeBotInvitePermissions(threadBit | Permissions.SEND_MESSAGES, mask)).toBe(mask);
expect(
canAuthorizeBotInvite({
userPermissions: Permissions.MANAGE_GUILD,
requestedPermissions: threadBit,
mask,
}),
).toBe(false);
expect(
canAuthorizeBotInvite({
userPermissions: Permissions.MANAGE_GUILD | threadBit,
requestedPermissions: threadBit,
mask,
}),
).toBe(true);
});
});