added customTextSuggest and some ajustments in the bot

This commit is contained in:
2022-11-14 21:00:10 -03:00
parent ee340cb9c5
commit 7126a76037
6 changed files with 122 additions and 39 deletions

9
app.js
View File

@@ -1,15 +1,18 @@
const fs = require('fs');
const path = require('path');
const { Collection, Client, GatewayIntentBits, Events } = require('discord.js');
const { getRandomElementFromArray } = require('./constants');
require('dotenv').config();
const enviroment = process.env.NODE_ENV;
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.on('ready', () => {
console.log('working');
});
client.login(process.env.BOT_TOKEN);
client.login(enviroment === 'production' ? process.env.PROD_BOT_TOKEN : process.env.DEV_BOT_TOKEN);
client.commands = new Collection();
@@ -28,6 +31,10 @@ for (const file of commandFiles) {
}
client.on(Events.InteractionCreate, async interaction => {
if (enviroment !== 'production' && interaction.user.id !== process.env.MY_DISCORD_USER_ID) {
interaction.reply(`The dev instance of this bot is only for ${getRandomElementFromArray([`<@${process.env.MY_DISCORD_USER_ID}>`, 'the king'])}`);
return;
}
const command = interaction.client.commands.get(interaction.commandName);
if (interaction.isChatInputCommand()) {
try {