diff --git a/.changeset/feat-enable-all-intents-and-logging.md b/.changeset/feat-enable-all-intents-and-logging.md new file mode 100644 index 0000000..c3623f5 --- /dev/null +++ b/.changeset/feat-enable-all-intents-and-logging.md @@ -0,0 +1,8 @@ +--- +"@djs-core/runtime": minor +--- + +feat: add support for partials in configuration and enable all intents by default in `DjsClient`. +- Add `partials` to the `Config` interface. +- Update `DjsClient` constructor to include more default intents. +- Added default `partials` support in `DjsClient` for partial data handling. diff --git a/app/src/events/message.ts b/app/src/events/message.ts new file mode 100644 index 0000000..5bce379 --- /dev/null +++ b/app/src/events/message.ts @@ -0,0 +1,9 @@ +import { EventListener } from "@djs-core/runtime"; +import { Events } from "discord.js"; + +export default new EventListener() + .event(Events.MessageCreate) + .run(async (_client, message) => { + if (message.author.bot) return; + console.log(message.content); + }); diff --git a/packages/runtime/DjsClient.ts b/packages/runtime/DjsClient.ts index 50aea0c..f2bd653 100644 --- a/packages/runtime/DjsClient.ts +++ b/packages/runtime/DjsClient.ts @@ -10,6 +10,7 @@ import { type Interaction, type MentionableSelectMenuInteraction, type ModalSubmitInteraction, + Partials, type RoleSelectMenuInteraction, type StringSelectMenuInteraction, type UserSelectMenuInteraction, @@ -56,9 +57,34 @@ export class DjsClient< }: { djsConfig: Config; userConfig?: UserConfig }) { super({ intents: djsConfig.intents ?? [ - IntentsBitField.Flags.MessageContent, + IntentsBitField.Flags.DirectMessageReactions, + IntentsBitField.Flags.DirectMessageTyping, + IntentsBitField.Flags.DirectMessages, + IntentsBitField.Flags.GuildModeration, + IntentsBitField.Flags.GuildExpressions, + IntentsBitField.Flags.GuildIntegrations, + IntentsBitField.Flags.GuildIntegrations, + IntentsBitField.Flags.GuildInvites, IntentsBitField.Flags.GuildMembers, + IntentsBitField.Flags.GuildMessageReactions, + IntentsBitField.Flags.GuildMessageTyping, + IntentsBitField.Flags.GuildMessages, IntentsBitField.Flags.GuildPresences, + IntentsBitField.Flags.GuildScheduledEvents, + IntentsBitField.Flags.GuildScheduledEvents, + IntentsBitField.Flags.GuildVoiceStates, + IntentsBitField.Flags.GuildWebhooks, + IntentsBitField.Flags.Guilds, + IntentsBitField.Flags.MessageContent, + ], + partials: djsConfig.partials ?? [ + Partials.Channel, + Partials.User, + Partials.Reaction, + Partials.Message, + Partials.GuildMember, + Partials.GuildScheduledEvent, + Partials.ThreadMember, ], }); this.djsConfig = djsConfig; diff --git a/packages/utils/types/config.d.ts b/packages/utils/types/config.d.ts index 9fb8dde..c1d17dc 100644 --- a/packages/utils/types/config.d.ts +++ b/packages/utils/types/config.d.ts @@ -2,6 +2,7 @@ import type { BitFieldResolvable, GatewayIntentsString, InteractionContextType, + Partials, } from "discord.js"; import type { PluginsConfigMap } from "../../runtime/Plugin"; @@ -10,6 +11,7 @@ export interface Config

{ token: string; servers: string[]; intents?: BitFieldResolvable; + partials?: Partials[]; commands?: { defaultContext?: InteractionContextType[]; };