Integrations · JavaScript

Discord Bot

Build an AI-powered Discord bot with XALEN. Astrology bot, temple guide, or spiritual assistant for your Discord server.

1. Install

npm install discord.js xalen-sdk

2. Code

#89B4FA;">import { Client, GatewayIntentBits } from 'discord.js';
#89B4FA;">import XALEN from 'xalen-sdk';

#89B4FA;">const xalen = new XALEN({ apiKey: 'xln_test_YOUR_KEY' });
#89B4FA;">const bot = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages] });

bot.on('messageCreate', #89B4FA;">async (msg) => {
  #89B4FA;">if (msg.content.startsWith('!ask ')) {
    #89B4FA;">const response = await xalen.chat.completions.create({
      model: 'vedika-fast',
      messages: [{ role: 'user', content: msg.content.slice(5) }]
    });
    msg.reply(response.choices[0].message.content);
  }
});

bot.login(process.env.DISCORD_TOKEN);

Related Tutorials

Build a React Chatbot Integrations · JavaScript Next.js API Routes Integrations · JavaScript Flutter Integration Integrations · Dart LangChain Integration Integrations · Python Python Quickstart Getting Started · Python JavaScript Quickstart Getting Started · JavaScript

200+ AI models. One API. Start building in 5 minutes.

Get API Key

Last updated: 2026-05-21