Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/feat-enable-all-intents-and-logging.md
Original file line number Diff line number Diff line change
@@ -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.
9 changes: 9 additions & 0 deletions app/src/events/message.ts
Original file line number Diff line number Diff line change
@@ -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);
});
28 changes: 27 additions & 1 deletion packages/runtime/DjsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
type Interaction,
type MentionableSelectMenuInteraction,
type ModalSubmitInteraction,
Partials,
type RoleSelectMenuInteraction,
type StringSelectMenuInteraction,
type UserSelectMenuInteraction,
Expand Down Expand Up @@ -56,9 +57,34 @@ export class DjsClient<
}: { djsConfig: Config<Plugins>; 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;
Expand Down
2 changes: 2 additions & 0 deletions packages/utils/types/config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type {
BitFieldResolvable,
GatewayIntentsString,
InteractionContextType,
Partials,
} from "discord.js";
import type { PluginsConfigMap } from "../../runtime/Plugin";

Expand All @@ -10,6 +11,7 @@ export interface Config<P extends readonly any[] = any[]> {
token: string;
servers: string[];
intents?: BitFieldResolvable<GatewayIntentsString, number>;
partials?: Partials[];
commands?: {
defaultContext?: InteractionContextType[];
};
Expand Down