Examples

Client

How to create and configure your Discord bot client with glyria.js.

Basic setup

The GlyriaClient is the entry point of your bot. It wraps discord.js's Client and handles token loading, command registration, and interaction routing automatically.

// src/index.ts
const client = new GlyriaClient({
  intents: [GatewayIntentBits.Guilds]
})

await client.login()
Your bot token is loaded automatically from the TOKEN variable in your .env file. Never hardcode it in your source code.

Intents

Intents tell Discord which events your bot wants to receive. Pass them via the intents option:

const client = new GlyriaClient({
  intents: [
    GatewayIntentBits.Guilds,
    GatewayIntentBits.GuildMessages,
    GatewayIntentBits.GuildMembers,
  ]
})
GlyriaClient and GatewayIntentBits are available globally — no imports needed.

Graceful shutdown

glyria.js automatically handles CTRL+C — the bot disconnects cleanly and goes offline on Discord instantly.

No extra code needed on your end.

Copyright © 2026