diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2022-12-20 17:54:56 -0500 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2022-12-20 18:05:51 -0500 |
| commit | e5c86859e4c6a9a6829bcc2e3cf626b05a873ff7 (patch) | |
| tree | 96c04baa3f064a160a595a0faf73696cc5cf8eaa /bot.js | |
| parent | 239b254760381946f57d6cbccb077f5341ca2f30 (diff) | |
| download | DLAP-e5c86859e4c6a9a6829bcc2e3cf626b05a873ff7.tar.gz DLAP-e5c86859e4c6a9a6829bcc2e3cf626b05a873ff7.tar.bz2 DLAP-e5c86859e4c6a9a6829bcc2e3cf626b05a873ff7.zip | |
Revamped next/previous cmds (Voting system); Basic i18n support;
Diffstat (limited to 'bot.js')
| -rw-r--r-- | bot.js | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -18,11 +18,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. * ***************************************************************************/ -import { Client, GatewayIntentBits, EmbedBuilder, Collection, version, InteractionType } from 'discord.js'; +import { Client, Events, GatewayIntentBits, EmbedBuilder, Collection, version, InteractionType } from 'discord.js'; import { voiceInit } from './AudioBackend/VoiceInitialization.js'; import { readdirSync, readFileSync } from 'node:fs'; // import config from './config.json' assert { type: 'json' } Not supported by ESLint yet -const { token, statusChannel, voiceChannel, shuffle, repeat, presenceActivity, activityType } = JSON.parse(readFileSync('./config.json', 'utf-8')); +const { token, statusChannel, voiceChannel, djRole, ownerID, shuffle, repeat, presenceActivity, activityType } = JSON.parse(readFileSync('./config.json', 'utf-8')); const bot = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildVoiceStates] }); bot.login(token); @@ -41,12 +41,14 @@ for (const file of commandFiles) { bot.commands.set(command.data.name, command); } -bot.once('ready', async() => { +bot.once(Events.ClientReady, async() => { console.log('Bot is ready!'); console.log(`Logged in as ${bot.user.tag}!`); console.log(`Running on Discord.JS ${version}`); console.log(`Voice Channel: ${voiceChannel}`); console.log(`Status Channel: ${statusChannel}`); + console.log(`DJ Role: ${djRole}`); + console.log(`Owner ID: ${ownerID}`); console.log(`Shuffle Enabled: ${shuffle}`); console.log(`Repeat Enabled: ${repeat}`); @@ -75,9 +77,9 @@ bot.once('ready', async() => { return await voiceInit(bot); }); -bot.on('interactionCreate', async interaction => { +bot.on(Events.InteractionCreate, async interaction => { if (interaction.type === !InteractionType.ApplicationCommand) return; - + if (!interaction.isChatInputCommand()) return; const command = bot.commands.get(interaction.commandName); if (!command) return; @@ -86,6 +88,6 @@ bot.on('interactionCreate', async interaction => { await command.execute(interaction, bot); } catch (e) { console.error(e); - await interaction.reply({ content: `There was an error while executing this command!\nShare this to the bot owner!\n\nDetails:\`\`\`${e}\`\`\``, ephemeral: true }); + await interaction.reply({ content: `There was an error while executing this command...\nShare this to the bot owner or report it to the git repository in \`/about\`\n\nDetails:\`\`\`${e}\`\`\``, ephemeral: true }); } }); |
