GlyriaClient
Overview
GlyriaClient extends discord.js's Client and adds glyria.js features on top — automatic command/event loading, hot reload support, graceful shutdown, and a built-in event bus.
const client = new GlyriaClient({
intents: [GatewayIntentBits.Guilds]
})
await client.login()
Constructor
new GlyriaClient(options: GlyriaClientOptions)
GlyriaClientOptions
| Option | Type | Required | Description |
|---|---|---|---|
intents | BitFieldResolvable<GatewayIntentsString, number> | ✅ | Discord gateway intents |
TOKEN variable in your .env. Never pass it manually.Properties
| Property | Type | Description |
|---|---|---|
bus | GlyriaBus<GlyriaEvents> | Internal event bus |
commandsManager | CommandManager | Manages command loading and registration |
eventsManager | EventManager | Manages event loading and registration |
Methods
login()
await client.login()
Starts the bot. Internally:
- Loads and registers all event files from
src/events/ - Connects to Discord
- Loads and registers all command files from
src/commands/ - Listens for hot reload messages in dev mode
Returns a Promise<string> — the token used to log in.
Events
GlyriaClient extends discord.js's ClientEvents with one additional event:
glyria:ready
Emitted when the bot is fully ready — after commands and events are loaded.
client.bus.on("glyria:ready", ({ uptime, shardId }) => {
console.log(`Ready on shard ${shardId}, uptime: ${uptime}ms`)
})
| Payload | Type | Description |
|---|---|---|
uptime | number | Time since login in milliseconds |
shardId | number | Current shard ID |
Graceful shutdown
GlyriaClient listens for SIGINT and SIGTERM automatically. When either signal is received, it:
- Destroys the discord.js connection
- Sets the bot offline on Discord
- Exits the process cleanly
No extra code needed.
Hot reload
In dev mode (glyria dev), GlyriaClient listens for IPC messages from the CLI watcher:
| Message | Action |
|---|---|
hotreload:commands | Reloads all commands without restarting |
hotreload:events | Reloads all events without restarting |
hotreload:config | Reloads glyria.config.ts without restarting |
This is handled automatically — no configuration needed.
Inheritance
GlyriaClient extends discord.js's Client. All discord.js properties and methods are available:
client.guilds.cache
client.users.fetch(userId)
client.channels.fetch(channelId)
// ...
Refer to the discord.js documentation for the full API.

