From 2a34e89f06335cdb3fb7a85e7fe6435e7a1fc32b Mon Sep 17 00:00:00 2001 From: Josh Date: Sun, 28 Apr 2019 21:22:00 -0500 Subject: [PATCH] Echo command --- commands.js | 8 +++++++- commands/echo.js | 14 ++++++++++++++ commands/set.js | 2 +- mbot.js | 16 ++++++++++------ tools.js | 4 ++-- 5 files changed, 34 insertions(+), 10 deletions(-) create mode 100644 commands/echo.js diff --git a/commands.js b/commands.js index 833c58e..c78b86e 100644 --- a/commands.js +++ b/commands.js @@ -11,7 +11,7 @@ module.exports.registerCommands = function(client) { client.commands.set(cmd.name, cmd); } client.on('message', async message => { - if (message.author.bot) return; + //if (message.author.bot) return; if (message.channel.type === 'dm') return; if (message.content.indexOf(settings.prefix) !== 0) return; const args = message.content.slice(settings.prefix.length).split(' '); @@ -75,6 +75,12 @@ module.exports.registerCommands = function(client) { case "set": client.commands.get('set').execute(message, args); break; + case "echo": + client.commands.get('echo').execute(message, args); + break; + /*case "hey": only reason why checking if bot is needed. + message.channel.send('!hey'); + break;*/ diff --git a/commands/echo.js b/commands/echo.js new file mode 100644 index 0000000..fe1f520 --- /dev/null +++ b/commands/echo.js @@ -0,0 +1,14 @@ +module.exports = { + name: 'echo', + async execute(message, args) { + let hasAdmin = message.channel.permissionsFor(message.member).has("ADMINISTRATOR"); + if (!hasAdmin) { + return message.channel.send(message.author + " You don't have permission to use this command!"); + } + const echo = args.join(' '); + if (args.length === 0) { + return message.reply('Please add parms! !echo '); + } + await message.channel.send(echo); + }, +}; \ No newline at end of file diff --git a/commands/set.js b/commands/set.js index bd189cb..c13e9f6 100644 --- a/commands/set.js +++ b/commands/set.js @@ -11,7 +11,7 @@ module.exports = { execute(message, args) { let hasAdmin = message.channel.permissionsFor(message.member).has("ADMINISTRATOR"); if (!hasAdmin) { - return message.channel.send(message.author + " You don't have permission to use this command!") + return message.channel.send(message.author + " You don't have permission to use this command!"); } if (args.length < 2) { return message.reply('Please add params! !set <@user> '); diff --git a/mbot.js b/mbot.js index e7173b6..d0ee321 100644 --- a/mbot.js +++ b/mbot.js @@ -31,12 +31,16 @@ client.on('ready', async () => { }); console.log('mbot v' + package.version + " has been enabled."); //game - client.user.setPresence({ - satus: 'online', - game: { - name: 'Minecraft' - } - }); + var games = ['Minecraft', 'Murdering Martine the BOT', 'nymnBridge PewDiePie', 'Acrozze a mega gay', 'This bot was made by me :)']; + setInterval(function() { + var randomStatus = games[Math.floor(Math.random() * games.length)]; + client.user.setPresence({ + satus: 'online', + game: { + name: randomStatus + } + }); + }, 60000); if (debug) { try { let link = await client.generateInvite(["ADMINISTRATOR"]); diff --git a/tools.js b/tools.js index 5f95078..dafae72 100644 --- a/tools.js +++ b/tools.js @@ -18,7 +18,7 @@ module.exports.setPoints = function(amnt, id) { } module.exports.roulette = function(amnt, current, message, client, all) { - const smile = client.emojis.get("572221263435661322"); + const smile = client.emojis.get("566861749324873738"); const wtf = client.emojis.get("567905581868777492"); const chance = Math.floor(Math.random() * 100); var wonall; @@ -203,4 +203,4 @@ module.exports.find = async function(list, searchTerm, time, message) { } catch (err) { console.log(err); } -} +} \ No newline at end of file