mirror of
https://github.com/FranP-code/shopping-discord-bot.git
synced 2025-10-13 00:22:44 +00:00
added customTextSuggest and some ajustments in the bot
This commit is contained in:
9
app.js
9
app.js
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user