From 4cd8a4298597938cc1e30ed18e0ddbcebede4a15 Mon Sep 17 00:00:00 2001 From: ION606 Date: Fri, 20 May 2022 12:19:27 +0300 Subject: [PATCH] Added the 'help' command. Output is unordered thought --- commands/game/game.js | 12 ++++++++++++ commands/misc/commandhelp.js | 17 ++++++++++------- main.js | 31 +++++++++++++++++++++++++++---- 3 files changed, 49 insertions(+), 11 deletions(-) create mode 100644 commands/game/game.js diff --git a/commands/game/game.js b/commands/game/game.js new file mode 100644 index 0000000..ceadf3c --- /dev/null +++ b/commands/game/game.js @@ -0,0 +1,12 @@ +module.exports ={ + name: "game", + description: "Play a game using Selmer Bot!", + execute(message, args, Discord, Client, bot) { + let temp = "Selmer Bot Commands:\n"; + var keys = bot.commands.keys(); + for (let i = 0; i < keys.length; i ++) { + temp += keys[i].toLowerCase(); + temp += ` - ${bot.commands.get(keys[i]).description}\n`; + } + } +} \ No newline at end of file diff --git a/commands/misc/commandhelp.js b/commands/misc/commandhelp.js index e2d24a5..79fc86c 100644 --- a/commands/misc/commandhelp.js +++ b/commands/misc/commandhelp.js @@ -2,13 +2,16 @@ module.exports ={ name: "help", description: "Gets help for all of Selmer Bot's commands", execute(message, args, Discord, Client, bot) { - const newEmbed = new Discord.MessageEmbed() - .setColor('#002eff') - .setTitle('My professional resume') - //.setURL('https://discordjs.guide/popular-topics/embeds.html#embed-preview') - //.setDescription('My professional resume') - .setImage('https://github.com/ION606/selmerBot/blob/main/Sleemer_Bringsjorgend.png?raw=true') + let temp = "***Selmer Bot Commands:***\n"; - message.channel.send({ embeds: [newEmbed] }); + bot.commands.sort((a, b) => a.name[0] < b.name[0]); + + bot.commands.forEach((comm) => { + if (comm.name != 'verify') { + temp += `${comm.name.toLowerCase()} - ${comm.description}\n`; + } + }); + + message.channel.send(temp); } } \ No newline at end of file diff --git a/main.js b/main.js index ae68989..f4955c0 100644 --- a/main.js +++ b/main.js @@ -5,6 +5,19 @@ const fs = require('fs'); const { exit } = require('process'); const BASE_LVL_XP = 20; + +//Token area +//Adding integration for development mode +let token; +let inDebugMode = false; +if (process.env.token != undefined) { + //Use "setx NAME VALUE" in the local powershell terminal to set + token = process.env.token; +} else { + token = require('./config.json').token; + inDebugMode = true; +} + // const { token } = require('./config.json'); //Heroku part // const { token } = process.env.token; @@ -25,7 +38,14 @@ bot.prefix = prefix; //MongoDB integration -const mongouri = process.env.MONGODB_URI; +//Development support +let mongouritemp; +if (process.env.MONGODB_URI) { + mongouritemp = process.env.MONGODB_URI; +} else { + mongouritemp = require('./config.json'); +} +const mongouri = mongouritemp; const { connect } = require('mongoose'); bot.on("guildCreate", guild => { @@ -100,8 +120,11 @@ bot.on('ready', async () => { //Reaction map area - - console.log('SLEEMER BOT ONLINE!!!!! OH MY GOD OH MY GOD!!!'); + if (!inDebugMode) { + console.log('SLEEMER BOT ONLINE!!!!! OH MY GOD OH MY GOD!!!'); + } else { + console.log("Testing testing 1 2 5..."); + } }); @@ -128,4 +151,4 @@ bot.on('messageCreate', (message) => { //Last Line(s) // bot.login(token); -bot.login(process.env.token); \ No newline at end of file +bot.login(token); \ No newline at end of file