Examples

Real-world bot examples and code snippets.

🎮 Gaming Bot

Dice Command

commands/dice.js
bot.command.new('dice', 'Roll dice', async function() {
const count = this.getInteger('count') || 1;
const rolls = [];
for (let i = 0; i < count; i++) {
rolls.push(this.random.number(1, 6));
}
const total = rolls.reduce((a, b) => a + b, 0);
await this.reply(`🎲 Rolls: ${rolls.join(', ')} | Total: ${total}`);
}, [{
name: 'count',
description: 'Number of dice',
type: 4,
required: false
}]);

8-Ball Command

commands/8ball.js
bot.command.new('8ball', 'Ask the magic 8-ball', async function() {
const question = this.getString('question');
const responses = [
'Yes', 'No', 'Maybe', 'Definitely',
'Ask again later', 'Cannot predict now'
];
const answer = this.random.pick(responses);
await this.reply(`🎱 ${question}\n**${answer}**`);
}, [{
name: 'question',
description: 'Your question',
type: 3,
required: true
}]);

📚 More Examples