Skip to content

Commit

Permalink
Add Intents
Browse files Browse the repository at this point in the history
  • Loading branch information
IanMitchell committed Aug 3, 2023
1 parent 1b3e8e1 commit a0b5506
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 4 deletions.
23 changes: 23 additions & 0 deletions packages/discord-bitflag/src/flags/intents.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import type { BitFlags } from "bitflag-js";

export const IntentFlags: BitFlags = Object.freeze({
Guilds: 1n << 0n,
GuildMembers: 1n << 1n,
GuildModeration: 1n << 2n,
GuildEmojisAndStickers: 1n << 3n,
GuildIntegrations: 1n << 4n,
GuildWebhooks: 1n << 5n,
GuildInvites: 1n << 6n,
GuildVoiceStates: 1n << 7n,
GuildPresences: 1n << 8n,
GuildMessages: 1n << 9n,
GuildMessageReactions: 1n << 10n,
GuildMessageTyping: 1n << 11n,
DirectMessages: 1n << 12n,
DirectMessageReactions: 1n << 13n,
DirectMessageTyping: 1n << 14n,
MessageContent: 1n << 15n,
GuildScheduledEvents: 1n << 16n,
AutoModerationConfiguration: 1n << 20n,
AutoModerationExecution: 1n << 21n,
});
3 changes: 3 additions & 0 deletions packages/discord-bitflag/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ export { ApplicationFlagsBitField } from "./wrappers/applications.js";
export { ChannelFlags } from "./flags/channel.js";
export { ChannelFlagsBitField } from "./wrappers/channels.js";

export { IntentFlags } from "./flags/intents.js";
export { IntentFlagsBitField } from "./wrappers/intents.js";

export { MessageFlags } from "./flags/message.js";
export { MessageFlagsBitField } from "./wrappers/messages.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/discord-bitflag/src/wrappers/applications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ApplicationFlags } from "../flags/application.js";

export class ApplicationFlagsBitField extends BitField {
static ALL = Object.values(ApplicationFlags).reduce(
(total, flag) => total | BigInt(flag),
(total, flag) => total | flag,
0n
);
}
2 changes: 1 addition & 1 deletion packages/discord-bitflag/src/wrappers/channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ChannelFlags } from "../flags/channel.js";

export class ChannelFlagsBitField extends BitField {
static ALL = Object.values(ChannelFlags).reduce(
(total, flag) => total | BigInt(flag),
(total, flag) => total | flag,
0n
);
}
9 changes: 9 additions & 0 deletions packages/discord-bitflag/src/wrappers/intents.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { BitField } from "bitflag-js";
import { IntentFlags } from "../flags/intents.js";

export class IntentFlagsBitField extends BitField {
static ALL = Object.values(IntentFlags).reduce(
(total, flag) => total | flag,
0n
);
}
2 changes: 1 addition & 1 deletion packages/discord-bitflag/src/wrappers/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { MessageFlags } from "../flags/message.js";

export class MessageFlagsBitField extends BitField {
static ALL = Object.values(MessageFlags).reduce(
(total, flag) => total | BigInt(flag),
(total, flag) => total | flag,
0n
);
}
2 changes: 1 addition & 1 deletion packages/discord-bitflag/src/wrappers/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { UserFlags } from "../flags/user.js";

export class UserFlagsBitField extends BitField {
static ALL = Object.values(UserFlags).reduce(
(total, flag) => total | BigInt(flag),
(total, flag) => total | flag,
0n
);
}

0 comments on commit a0b5506

Please sign in to comment.