mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
feat(types): add InvitesDisabled to GuildFeatures (#2439)
* types/shared: add InvitesDisabled to GuildFeatures * add AutoModeration, InvitesDisabled to GuildToggle * GuildToggles: add getters * deno fmt (1.25.2) * jsdoc comments
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { DiscordGuild } from "../../types/discord.ts";
|
||||
import { GuildFeatures } from "../../types/shared.ts";
|
||||
import { ToggleBitfield, ToggleBitfieldBigint } from "./ToggleBitfield.ts";
|
||||
import { ToggleBitfieldBigint } from "./ToggleBitfield.ts";
|
||||
|
||||
export const GuildToggle = {
|
||||
/** Whether the bot is the owner of the guild */
|
||||
@@ -58,6 +58,10 @@ export const GuildToggle = {
|
||||
privateThreads: 1n << 26n,
|
||||
/** Whether the guild is able to set role icons */
|
||||
roleIcons: 1n << 27n,
|
||||
/** Whether the guild has set up auto moderation rules */
|
||||
autoModeration: 1n << 28n,
|
||||
/** Whether the guild has paused invites, preventing new users from joining */
|
||||
invitesDisabled: 1n << 29n,
|
||||
};
|
||||
|
||||
export class GuildToggles extends ToggleBitfieldBigint {
|
||||
@@ -93,6 +97,8 @@ export class GuildToggles extends ToggleBitfieldBigint {
|
||||
if (guild.features.includes(GuildFeatures.MoreStickers)) this.add(GuildToggle.moreStickers);
|
||||
if (guild.features.includes(GuildFeatures.PrivateThreads)) this.add(GuildToggle.privateThreads);
|
||||
if (guild.features.includes(GuildFeatures.RoleIcons)) this.add(GuildToggle.roleIcons);
|
||||
if (guild.features.includes(GuildFeatures.AutoModeration)) this.add(GuildToggle.autoModeration);
|
||||
if (guild.features.includes(GuildFeatures.InvitesDisabled)) this.add(GuildToggle.invitesDisabled);
|
||||
}
|
||||
|
||||
/** Whether the bot is the owner of the guild */
|
||||
@@ -206,6 +212,16 @@ export class GuildToggles extends ToggleBitfieldBigint {
|
||||
return this.has("roleIcons");
|
||||
}
|
||||
|
||||
/** Whether the guild has set up auto moderation rules */
|
||||
get autoModeration() {
|
||||
return this.has("autoModeration");
|
||||
}
|
||||
|
||||
/** Whether the guild has paused invites, preventing new users from joining */
|
||||
get invitesDisabled() {
|
||||
return this.has("invitesDisabled");
|
||||
}
|
||||
|
||||
/** Checks whether or not the permissions exist in this */
|
||||
has(permissions: GuildToggleKeys | GuildToggleKeys[]) {
|
||||
if (!Array.isArray(permissions)) return super.contains(GuildToggle[permissions]);
|
||||
|
||||
@@ -235,6 +235,8 @@ export enum GuildFeatures {
|
||||
RoleIcons = "ROLE_ICONS",
|
||||
/** Guild has set up auto moderation rules */
|
||||
AutoModeration = "AUTO_MODERATION",
|
||||
/** Guild has paused invites, preventing new users from joining */
|
||||
InvitesDisabled = "INVITES_DISABLED",
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#guild-object-mfa-level */
|
||||
|
||||
Reference in New Issue
Block a user