mirror of
https://github.com/cassoule/flopobot_v2.git
synced 2026-01-18 16:37:40 +01:00
45 lines
980 B
JavaScript
45 lines
980 B
JavaScript
import 'dotenv/config';
|
|
import { getRPSChoices } from './game.js';
|
|
import { capitalize, InstallGlobalCommands } from './utils.js';
|
|
|
|
// Get the game choices from game.js
|
|
function createCommandChoices() {
|
|
const choices = getRPSChoices();
|
|
const commandChoices = [];
|
|
|
|
for (let choice of choices) {
|
|
commandChoices.push({
|
|
name: capitalize(choice),
|
|
value: choice.toLowerCase(),
|
|
});
|
|
}
|
|
|
|
return commandChoices;
|
|
}
|
|
|
|
// Simple test command
|
|
const TEST_COMMAND = {
|
|
name: 'test',
|
|
description: 'Basic command',
|
|
type: 1,
|
|
};
|
|
|
|
// Command containing options
|
|
const CHALLENGE_COMMAND = {
|
|
name: 'challenge',
|
|
description: 'Challenge to a match of rock paper scissors',
|
|
options: [
|
|
{
|
|
type: 3,
|
|
name: 'object',
|
|
description: 'Pick your object',
|
|
required: true,
|
|
choices: createCommandChoices(),
|
|
},
|
|
],
|
|
type: 1,
|
|
};
|
|
|
|
const ALL_COMMANDS = [TEST_COMMAND, CHALLENGE_COMMAND];
|
|
|
|
InstallGlobalCommands(process.env.APP_ID, ALL_COMMANDS); |