From 355a50803adc85b5579155b55ddbba4fa0449237 Mon Sep 17 00:00:00 2001 From: GramingFoxTeam Date: Thu, 17 Nov 2022 15:58:42 +0300 Subject: [PATCH] feat(discord-bot): a way to train AI --- bots/config.example.json | 3 ++- bots/discord/commands/trainAI.js | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 bots/discord/commands/trainAI.js diff --git a/bots/config.example.json b/bots/config.example.json index e9de5ff..055c2ef 100644 --- a/bots/config.example.json +++ b/bots/config.example.json @@ -2,7 +2,8 @@ "discord": { "token": "YOUR-BOT-TOKEN-HERE", "id": "1038762591805247518", - "trainRole": "965267139902705744" + "trainRole": "965267139902705744", + "trainingRole": "952987191401926697" }, "telegram": { diff --git a/bots/discord/commands/trainAI.js b/bots/discord/commands/trainAI.js new file mode 100644 index 0000000..ea3fc72 --- /dev/null +++ b/bots/discord/commands/trainAI.js @@ -0,0 +1,21 @@ +import { SlashCommandBuilder } from 'discord.js'; + +export default { + data: new SlashCommandBuilder() + .setName('train') + .setDescription('Train the AI.'), + async execute(interaction) { + if (!interaction.member.roles.cache.get(global.config.discord.trainingRole)) + return interaction.reply({ + content: 'You don\'t have the permission to do this.', + ephemeral: true + }); + + interaction.client.helper.trainAI(); + + interaction.reply({ + content: 'Sent the trainAI command to the server.', + ephemeral: true + }); + } +};