@stonyx/discord 0.1.1-alpha.21 → 0.1.1-alpha.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +8 -8
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -11,7 +11,7 @@ Discord bot module for the [Stonyx framework](https://github.com/abofs/stonyx),
11
11
  * **Command auto-discovery:** Drop command files into a directory and the framework registers them automatically.
12
12
  * **Event handler auto-discovery:** Same pattern for Discord gateway events.
13
13
  * **Intent auto-derivation:** Required intents computed from discovered event handlers.
14
- * **Lazy initialization:** Bot only starts if a token is configured and commands/events exist.
14
+ * **Token-gated start:** The bot logs in only when a token is configured. With a token and no commands or events, it still logs in, so a send-only bot works.
15
15
  * **Singleton pattern:** Matches conventions of `@stonyx/sockets` and `@stonyx/events`.
16
16
  * **Utility methods:** sendMessage, reply with auto-chunking, role management, and more.
17
17
 
@@ -23,7 +23,7 @@ pnpm install @stonyx/discord
23
23
 
24
24
  ## Quick Start
25
25
 
26
- [`test/sample/`](https://github.com/abofs/stonyx-discord/tree/dev/test/sample) is the canonical usage reference: a working command and event handler, imported the way an app imports them.
26
+ The examples below are complete files: each one imports only from `@stonyx/discord` subpaths, so it runs in an app that depends on nothing but `@stonyx/discord`. The repo's `test/sample/` directory holds a command and an event handler written the same way ([source](https://github.com/abofs/stonyx-discord/tree/dev/test/sample)), and the test suite loads them on every run.
27
27
 
28
28
  ### 1. Create handler directories
29
29
 
@@ -38,7 +38,7 @@ discord-events/ # default directory (configurable)
38
38
 
39
39
  ```javascript
40
40
  // discord-commands/ping.js
41
- import { SlashCommandBuilder } from 'discord.js';
41
+ import { SlashCommandBuilder } from '@stonyx/discord/base';
42
42
  import Command from '@stonyx/discord/command';
43
43
 
44
44
  export default class PingCommand extends Command {
@@ -61,9 +61,9 @@ import EventHandler from '@stonyx/discord/event-handler';
61
61
  export default class MessageCreateHandler extends EventHandler {
62
62
  static event = 'messageCreate';
63
63
 
64
- handle(message) {
64
+ async handle(message) {
65
65
  if (message.author.bot) return;
66
- console.log(`${message.author.username}: ${message.content}`);
66
+ if (message.content === '!ping') await message.reply('pong');
67
67
  }
68
68
  }
69
69
  ```
@@ -76,9 +76,9 @@ Stonyx auto-initializes the bot when your app boots — no manual wiring needed:
76
76
  stonyx serve
77
77
  ```
78
78
 
79
- `Discord.init()` (called by the Stonyx module loader) awaits `new DiscordBot().init()`, which discovers commands/events, derives intents, and connects to the gateway. The lazy-init guards still apply: if `DISCORD_TOKEN` is unset or no commands/events exist, the bot skips login.
79
+ `Discord.init()` (called by the Stonyx module loader) awaits `new DiscordBot().init()`, which discovers commands/events, derives intents, and connects to the gateway. If `DISCORD_TOKEN` is unset, the bot skips login. With a token it always logs in, even when no commands or events exist.
80
80
 
81
- ## Package Exports
81
+ ## Exports
82
82
 
83
83
  | Import | Provides |
84
84
  |--------|----------|
@@ -161,7 +161,7 @@ The framework automatically computes the required intents from your registered e
161
161
  | `voiceStateUpdate` | `GuildVoiceStates` |
162
162
  | `interactionCreate` | *(none — handled by default)* |
163
163
 
164
- **`Guilds` is always included** when commands are registered.
164
+ **`Guilds` is always included**, whether or not any commands or events are registered.
165
165
 
166
166
  ### Intent-to-Partial Mapping
167
167
 
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "stonyx-async",
5
5
  "stonyx-module"
6
6
  ],
7
- "version": "0.1.1-alpha.21",
7
+ "version": "0.1.1-alpha.22",
8
8
  "description": "Discord bot module for the Stonyx framework",
9
9
  "main": "dist/main.js",
10
10
  "types": "dist/main.d.ts",