From 3c8023f23931f8573bdf27ed8f3e674c04ff7eaa Mon Sep 17 00:00:00 2001 From: 8cy <50817549+8cy@users.noreply.github.com> Date: Tue, 7 Apr 2020 10:21:53 -0700 Subject: port all the stuff from app.js to commands/ --- app.js | 565 ++---------------------------------------- app_backup.js | 643 ++++++++++++++++++++++++++++++++++++++++++++++++ app_legacy.js | 358 +++++++++++++++++++++++++++ commands/8ball.js | 19 ++ commands/abee.js | 21 ++ commands/clear.js | 46 ++++ commands/commands.js | 32 +++ commands/dm.js | 66 +++++ commands/emoji.js | 10 + commands/fart.js | 80 ++++++ commands/help.js | 37 +++ commands/join.js | 15 ++ commands/leave.js | 12 + commands/membercount.js | 8 + commands/ping.js | 21 ++ commands/quote.js | 18 ++ commands/reboot.js | 10 + commands/say.js | 11 + commands/server.js | 26 ++ commands/squeak.js | 20 ++ commands/uhhhh.js | 20 ++ commands/wahoo.js | 20 ++ 22 files changed, 1516 insertions(+), 542 deletions(-) create mode 100644 app_backup.js create mode 100644 app_legacy.js create mode 100644 commands/8ball.js create mode 100644 commands/abee.js create mode 100644 commands/clear.js create mode 100644 commands/commands.js create mode 100644 commands/dm.js create mode 100644 commands/emoji.js create mode 100644 commands/fart.js create mode 100644 commands/help.js create mode 100644 commands/join.js create mode 100644 commands/leave.js create mode 100644 commands/membercount.js create mode 100644 commands/ping.js create mode 100644 commands/quote.js create mode 100644 commands/reboot.js create mode 100644 commands/say.js create mode 100644 commands/server.js create mode 100644 commands/squeak.js create mode 100644 commands/uhhhh.js create mode 100644 commands/wahoo.js diff --git a/app.js b/app.js index 62d1dd2..69f98bf 100644 --- a/app.js +++ b/app.js @@ -1,10 +1,15 @@ +const fs = require('fs'); const Discord = require('discord.js'); const config = require('./config.json'); const bot = new Discord.Client(); -const isImageUrl = require('is-image-url'); -const emoji = require('emoji-random'); -const atquotes = require('at-quotes'); -const ytdl = require('ytdl-core'); +bot.commands = new Discord.Collection(); +const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js')); + +for (const file of commandFiles) { + const command = require(`./commands/${file}`); + + bot.commands.set(command.name, command); +} bot.on('ready', () => { console.log(`Started bot: ${bot.user.tag} (ID: ${bot.user.id})\nCurrently running on ${bot.guilds.size} server(s).`); // Startup dialouge in output console @@ -23,7 +28,7 @@ bot.on('error', console.error); // Start Bot Commands bot.on('message', async msg => { //console.log(msg.content.toLowerCase()); - if (msg.channel.name === 'bots' || msg.channel.name === 'bot-commands' || msg.member.hasPermission('KICK_MEMBERS')) { + //if (msg.channel.name === 'bots' || msg.channel.name === 'bot-commands' || msg.member.hasPermission('KICK_MEMBERS')) { var msgContent = msg.content.toLowerCase(); if (prefixCheck()) { console.log(msg.member.user.tag, 'says', msgContent, 'in #' + msg.channel.name); @@ -93,23 +98,7 @@ bot.on('message', async msg => { if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4b)) return; } - // Returns ping of bot - if (command == 'ping' || command == 'ms') { - const t = Date.now(); - - msg.channel.send('plz wait..').then(m => { - m.edit(`** **`); - - const n = Date.now(); - let emb = new Discord.RichEmbed() - - .setDescription(`pong! s5nical's is \`${n - t}ms\`. heartbeat \`${bot.ping}ms\`.`) - .setColor(0xF97DAE); - - msg.channel.send(RichEmbed = emb); - }); - } - + // Random edge case arguments function noArgs() { msg.channel.send(`invalid argument(s). type \`${config.prefixes.main}help\` for more information.`); } @@ -122,526 +111,18 @@ bot.on('message', async msg => { if (msg.member.hasPermission(p)) return true; } - // 8ball feature - if (command == '8ball' || command == 'ball' || command == '8b') { - r = ['yes~ uwu', 'no.', 'yes!', 'no!', 'what, no.', 'yes.', 'maybe.', 'perhaps.', 'try again.', 'i\'m not sure.']; - - var s = r[Math.floor(Math.random() * r.length)]; - - emb = new Discord.RichEmbed() - - .setAuthor('the 8-ball says', 'https://upload.wikimedia.org/wikipedia/commons/thumb/f/fd/8-Ball_Pool.svg/500px-8-Ball_Pool.svg.png') - .setDescription('`' + s + '`'); - - msg.channel.send(RichEmbed = emb); - } - - // Say feature, bot repeats what you say - if (command == 'say') { - if (msg.member.hasPermission('KICK_MEMBERS')) { - m = args.join(' '); - msg.channel.send(m); - msg.delete(); - } - } - - // Server info feature - if (command == 'server' || command == 'serverinfo') { - var o = msg.guild.members.filter(m => m.presence.status === 'online').size; - - emb = new Discord.RichEmbed() - - .setAuthor(`${msg.guild.name} - ${msg.guild.id}`, `${msg.guild.iconURL}`, `https://discordapp.com/channels/${msg.guild.id}/${msg.guild.id}`) - .setDescription(`here\'s all the information on \`${msg.guild.name}\``) - .setThumbnail(`${msg.guild.iconURL}`) - .addField('owner', `${msg.guild.owner}`, false) - .addField(`members [${msg.guild.memberCount}]`, `${o} members are online.`, true) - .addField('region', `${msg.guild.region}`, true) - .addField('text channels', `${msg.guild.channels.filter(c => c.type === 'text').size}`, true) - .addField('voice channels', `${msg.guild.channels.filter(c => c.type === 'voice').size}`, true) - .addField('guild created', `${msg.guild.createdAt}`, false) - .addField('s5nical joined', `${msg.guild.members.get('695107550403756192').joinedAt}`) - .setColor(0xF97DAE); - - msg.channel.send(RichEmbed = emb); - } - - if (command == 'leave') { - if (msg.guild.voiceConnection) { - msg.guild.voiceConnection.disconnect(); - msg.reply('succesfully left voice channel'); - } else { - msg.reply('i\'m not in a voice channel'); - } - } - - if (command == 'join') { - if (!msg.guild.voiceConnection && msg.member.voiceChannel) { - msg.member.voiceChannel.join(); - msg.reply('succesfully joined voice channel'); - } else if (msg.guild.voiceConnection) { - msg.reply('i\'m already in voice channel'); - } else if (!msg.member.voiceChannel) { - msg.reply('you\'re not in a voice channel'); - } - } - - if (command == 'reboot' | command == 'r') { - msg.member.voiceChannel.join(); - msg.member.voiceChannel.leave(); - msg.reply('reboot finished lol') - } - - /*if (command == 'pause') { - dispatcher.pause(); - } - - if (command == 'resume' || 'play') { - dispatcher.resume(); - } - - if (command == 'volume' || 'vol') { - - }*/ - - // Play mario on a bike - if (command == 'abee' || command == 'a-bee') { - if (msg.member.voiceChannel && !msg.guild.voiceConnection) { - const connection = await msg.member.voiceChannel.join(); - const dispatcher = connection.playFile('./assets/audio/mario_on_a_bike.mp3', { - volume: 0.5 - }); - - dispatcher.on('end', () => { - msg.member.voiceChannel.leave(); - }) - } else if (msg.guild.voiceConnection) { - msg.reply('i\'m already playing that lol') - } else { - msg.reply('you need to join a voice channel first silly'); - } - } - - // Play squeak on a bike - if (command == 'squeak') { - if (msg.member.voiceChannel && !msg.guild.voiceConnection) { - const connection = await msg.member.voiceChannel.join(); - const dispatcher = connection.playFile('./assets/audio/squeak.wav', { - volume: 0.2 - }); - - dispatcher.on('end', () => { - msg.member.voiceChannel.leave(); - }) - } else if (msg.guild.voiceConnection) { - msg.reply('i\'m already playing that lol') - } else { - msg.reply('you need to join a voice channel first silly'); - } - } - - // Play uhhhh - if (command == 'uhhhh') { - if (msg.member.voiceChannel && !msg.guild.voiceConnection) { - const connection = await msg.member.voiceChannel.join(); - const dispatcher = connection.playFile('./assets/audio/uhhhh.wav', { - volume: 0.5 - }); - - dispatcher.on('end', () => { - msg.member.voiceChannel.leave(); - }) - } else if (msg.guild.voiceConnection) { - msg.reply('i\'m already playing that lol') - } else { - msg.reply('you need to join a voice channel first silly'); - } - } - - // Plays Mase - Psycho - if (command == 'psycho') { - if (msg.member.voiceChannel && !msg.guild.voiceConnection) { - const connection = await msg.member.voiceChannel.join(); - const dispatcher = connection.playFile('./assets/audio/mase_psycho.mp3', { - volume: 0.5 - }); - - dispatcher.on('end', () => { - msg.member.voiceChannel.leave(); - }) - } else if (msg.guild.voiceConnection) { - msg.reply('i\'m already playing that lol') - } else { - msg.reply('you need to join a voice channel first silly'); - } - } - - if (command == 'fart') { - if (msg.member.voiceChannel && !msg.guild.voiceConnection) { - const connection = await msg.member.voiceChannel.join(); - var fartNum = Math.floor((Math.random() * 8) + 1); - - if (fartNum == 1) { - msg.reply('you got fart 1, courtesy of Sin') - const dispatcher = connection.playFile('./assets/audio/farts/1.mp3', { - volume: 0.5 - }); - dispatcher.on('end', () => { - msg.member.voiceChannel.leave(); - }) - } else if (fartNum == 2) { - msg.reply('you got fart 2, courtesy of Sin') - const dispatcher = connection.playFile('./assets/audio/farts/2.mp3', { - volume: 0.5 - }); - dispatcher.on('end', () => { - msg.member.voiceChannel.leave(); - }) - } else if (fartNum == 3) { - msg.reply('you got fart 3, courtesy of Sin') - const dispatcher = connection.playFile('./assets/audio/farts/3.mp3', { - volume: 0.5 - }); - dispatcher.on('end', () => { - msg.member.voiceChannel.leave(); - }) - } else if (fartNum == 4) { - msg.reply('you got fart 4, courtesy of Sin') - const dispatcher = connection.playFile('./assets/audio/farts/4.mp3', { - volume: 0.5 - }); - dispatcher.on('end', () => { - msg.member.voiceChannel.leave(); - }) - } else if (fartNum == 5) { - msg.reply('you got fart 5, courtesy of Sin') - const dispatcher = connection.playFile('./assets/audio/farts/5.mp3', { - volume: 0.5 - }); - dispatcher.on('end', () => { - msg.member.voiceChannel.leave(); - }) - } else if (fartNum == 6) { - msg.reply('you got fart 6, courtesy of nick') - const dispatcher = connection.playFile('./assets/audio/farts/6.mp3', { - volume: 0.5 - }); - dispatcher.on('end', () => { - msg.member.voiceChannel.leave(); - }) - } else if (fartNum == 7) { - msg.reply('you got fart 7, courtesy of nick') - const dispatcher = connection.playFile('./assets/audio/farts/7.mp3', { - volume: 0.5 - }); - dispatcher.on('end', () => { - msg.member.voiceChannel.leave(); - }) - } else if (fartNum == 8) { - msg.reply('you got fart 8, courtesy of nick') - const dispatcher = connection.playFile('./assets/audio/farts/8.mp3', { - volume: 0.5 - }); - dispatcher.on('end', () => { - msg.member.voiceChannel.leave(); - }) - } - } else if (msg.guild.voiceConnection) { - msg.reply('i\'m already playing that lol') - } else { - msg.reply('you need to join a voice channel first silly'); - } + // Begin commands + // if (command == 'ping') { + // bot.commands.get('ping').execute(bot, msg); + // } + try { + bot.commands.get(command).execute(msg, args, bot); + return; + } catch (error) { + console.error(error); } - - if (command == 'wahoo' | command == 'frozen' | command == 'frozenyyy') { - if (msg.member.voiceChannel && !msg.guild.voiceConnection) { - const connection = await msg.member.voiceChannel.join(); - const dispatcher = connection.playFile('./assets/audio/wahoo.mp3', { - volume: 1.0 - }); - - dispatcher.on('end', () => { - msg.member.voiceChannel.leave(); - }) - } else if (msg.guild.voiceConnection) { - msg.reply('i\'m already playing that lol') - } else { - msg.reply('you need to join a voice channel first silly'); - } - } - - if (command == 'yt-test') { - if (msg.member.voiceChannel && !msg.guild.voiceConnection) { - const connection = await msg.member.voiceChannel.join(); - const stream = ytdl('https://www.youtube.com/watch?v=3CS93CdMv_E', { filter: 'audioonly' }); - const dispatcher = connection.playStream(stream, { - volume: 0.5 - }); - - dispatcher.on('end', () => { - msg.member.voiceChannel.leave(); - }) - } else if (msg.guild.voiceConnection) { - msg.reply('i\'m already playing that lol') - } else { - msg.reply('you need to join a voice channel first silly'); - } - } - - // Help - if (command == 'help') { - if (!args.length) { - let emb = new Discord.RichEmbed() - - .setThumbnail(`${msg.guild.iconURL}`) - .setDescription(` - **command list**\nlink not yet set lol\n\n**categories list:**\n\`s5n!help \`\n\n**full list**\n\`s5n!commands\` - `) - .setColor(0xF97DAE); - - msg.channel.send(RichEmbed = emb); - } else if (args[0] == 'quotes' || args[0] == 'quote') { - let emb = new Discord.RichEmbed() - - .setTitle('quotes -> quote command: (server only)') - .setThumbnail(`${msg.guild.iconURL}`) - .setDescription(`says random quote from adventure time`) - .addField('details', `says random quote from adventure time -no argument: says a quote from any of the adventure time characters. -finn: says a quote from finn from adventure time. -jake: says a quote from jake from adventure time. -ice-king: says a quote from ice king from adventure time.`, false) - .addField(`format`, `\`s5n!quote [finn | jake | ice-king]\``, true) - .addField('examples', `\`s5n!quote\` - says a random quote any of the adventure time characters -\`s5n!quote finn\` - says a quote from finn from adventure time`, false) - .setFooter('<> - required, | - either/or, {} - optional') - .setColor(0xF97DAE); - - msg.channel.send(RichEmbed = emb); - } - } - - // Commands which you get directed to from help - if (command == 'commands') { - let emb = new Discord.RichEmbed() - - .setAuthor('s5nical\'s commands', `${msg.guild.iconURL}`) - .setThumbnail(`${msg.guild.iconURL}`) - .setDescription(`to view the commands in each group use:\n\`s5n!commands \``) - .addField(`:shield: moderation`, '13 commands.', true) - .addField(`:robot: automation`, '5 commands.', true) - .addField(`:gem: features`, '8 commands.', true) - .addField(`:lock: permissions`, '10 commands.', true) - .addField(`:mag_right: search`, '14 commands.', true) - .addField(`:wrench: utlity`, '20 commands.', true) - .addField(`:information_source: information`, '6 commands.', true) - .addField(`:smirk: fun`, '17 commands.', true) - .addField(`:moneybag: economy`, '8 commands.', true) - .addField(`:game_die: gambling`, '3 commands.', true) - .addField(`:smiley: profiles`, '4 commands.', true) - .addField(`:hammer_pick: skills`, '4 commands.', true) - .addField(`:frame_photo: image`, '3 commands.', true) - .addField(`:blue_heart: reaction`, '8 commands.', true) - .addField(`:chart_with_upwards_trend: counter`, '9 commands.', true) - .addField(`:sailboat: ship`, '2 commands.', true) - .setColor(0xF97DAE); - - msg.channel.send(RichEmbed = emb); - } - - // Member count - if (command == 'membercount' || command == 'memberc' || command == 'mcount' || command == 'mc') { - msg.reply(`there are **${msg.guild.memberCount}** members in **${msg.guild.name}**`); - } - - // Spits out random emoji - if (command == 'moji' || command == 'emoji') { - msg.reply(emoji.random()); - } - - // Spits out random quotes from Adventure TIme - if (command == 'quote' || command == 'quotes') { - if (!args.length) { - msg.reply(atquotes.getQuote()); - } else if (args[0] == 'finn') { - msg.reply(atquotes.getFinnQuote()); - } else if (args[0] == 'jake') { - msg.reply(atquotes.getJakeQuote()); - } else if (args[0] == 'ice-king') { - msg.reply(atquotes.getIceKingQuote()); - } - } - - // Clear/ delete messages in bulk command - if (command == 'clear' || command == 'delete' || command == 'del' || command == 'c') { - if (msg.member.hasPermission('MANAGE_MESSAGES')) { - if (!args) { - msg.reply('you haven\'t specified an amount of messages which should be deleted.').then(deleteNotificationMessage => { - deleteNotificationMessage.delete(1000); - }); - } else if (isNaN(args)) { - msg.reply('the amount parameter isn\'t a number.').then(deleteNotificationMessage => { - deleteNotificationMessage.delete(1000); - }); - } else if (args > 100) { - msg.reply('you can\'t delete more than 100 messages at once.').then(deleteNotificationMessage => { - deleteNotificationMessage.delete(1000); - }); - } else if (args < 1) { - msg.reply('you have to delete at least 1 message.').then(deleteNotificationMessage => { - deleteNotificationMessage.delete(1000); - }); - } /*else if (msg.createdTimestamp > 1209600) { - msg.reply('due to discord rules, bots can only bulk delete messages that are under 14 days old :(') - } */ - else { - var clearAmount = parseInt(args[0]) + 1 - // It took me so long to figure out why this was not really working. It would delete but an insane amount at a time. - // I realized that because it was getting parsed as a string, it would just add 1 to it so if I tried to delete 1 - // message, it would delete 11 lol. Fixed by parsing as integer THEN adding one. 02:30 2020/04/03/2020 - - await msg.channel.fetchMessages({ limit: clearAmount }).then(messages => { // I am on v11 discord.js - msg.channel.bulkDelete(messages); - }); - msg.reply('it\'s been deleted ~uwu').then(deleteNotificationMessage => { - deleteNotificationMessage.delete(1000); - }); - } - } else { - msg.reply('insufficent perms bruh'); - } - } - - if (command == 'dm') { - if (msg.author) { // TODO: fix discord not evaluating args[1] - if (!msg.mentions.users.first() && !args[1]) { - msg.reply('you haven\'t specified a user or a message.') - } else if (!args[1]) { - msg.reply('you haven\'t specified anything to send.') - } else if (!msg.mentions.users.first()) { - msg.reply('you haven\'t specified anyone to send a dm to.') - } else { - var sendTo = msg.mentions.users.first().id; - var d = new Date(msg.createdTimestamp); - - msg.guild.fetchMember(sendTo, false).then(messageUser => { - messageUser.send(args[0]) - - let emb = new Discord.RichEmbed() - - //.setDescription(`to view the commands in each group use:\n\`s5n!commands \``) - .addField(`message`, args[1], true) - .addField(`recipient`, args[0], true) - .addField(`time sent`, d) - .setColor(0xF97DAE); - - msg.channel.send(RichEmbed = emb); - }) - } - - // This shit took about an hour and a half to debug because I couldn't figure out how to convert the first arguement into - // a user id. After getting help from discord.js Discord I fixed it for about 30 seconds at 21:26 and then I broke it again instantlly - // after. Then I tried to fix everything and I almost broke everything again but I realized it was broken because I did s5n!dm instead - // of s5n!test and I hadn't ported the code over from test to. 2020/04/02, 21:34 - //where sendTo and d went - //args[0] = args[0].id - //msg.reply(args[0]); - // args[0]; - - // msg.reply(typeof args[0]) // for debugging - - // const collector = new Discord.MessageCollector(msg.channel, m => m.author.id === msg.author.id, { - // time: 5000 - // }); - // msg.reply('timed out', 5000) - // //console.log(collector) - - // collector.on('collect', message => { - // var messageText = message.content; - - // if (msg.member.message) { - // msg.reply('received') - // } - // }) - - // msg.reply('what would you like to say?'); - // if (msg.member.lastMessage) { - // var messageText = msg.member.lastMessage.content; - // } - - // where send function went - } else { - msg.reply('insufficent perms bruh'); - } - } - - if (msg.mentions.everyone) { - msg.react(':ArisaPing:695887537390223402'); - } - - /*if (command == 'botstatus' || command == 'status' || command == 'bs') { - if (msg.member.hasPermission('KICK_MEMBERS')) { - if (!args) { - msg.reply('no status specified') - } - - if (args == 'online') { - bot.user.setStatus("online"); - } else if (args == 'idle') { - bot.user.setStatus("idle"); - } else if (args == 'dnd') { - bot.user.setStatus("dnd"); - } else if (args == 'invisable') { - bot.user.setStatus("invisable"); - } - } else { - msg.reply('insufficent perms bruh'); - } - }*/ - - // Change status and status message - /*if (command == 'botstatus' || command == 'status' || command == 'bs') { - if (msg.member.hasPermission('KICK_MEMBERS')) { - if (!args[0] && !args[1]) { - msg.reply('you haven\'t specified a status or a message.') - } else if (!args[1]) { - msg.reply('you haven\'t specified a message.') - } else if (!args[0]) { - msg.reply('you haven\'t specified a status.') - } else { - status = args[0].toLocaleUpperCase(); - var d = new Date(msg.createdTimestamp); - - bot.user.setActivity(args[1], { - type: status - }); - - let emb = new Discord.RichEmbed() - - //.setDescription(`to view the commands in each group use:\n\`s5n!commands \``) - .addField(`status message`, args[1], true) - .addField(`status`, status, true) - .addField(`time changed`, d) - .setColor(0xF97DAE); - - msg.channel.send(RichEmbed = emb); - } - } - }*/ - - /*function joinCheck() { - switch (msg.guild.voiceConnection) { - case !msg.guild.voiceConnection && msg.member.voiceChannel: - msg.member.voiceChannel.join(); - msg.reply('succesfully joined voice channel') - case (msg.guild.voiceConnection): - msg.reply('i\'m already in voice channel') - case (!msg.member.voiceChannel): - msg.reply('you\'re not in a voice channel') - } - }*/ - } else if (msg.channel.name !== 'bots' && msg.content.startsWith(`${config.prefixes.main}`) && !msg.member.hasPermission('KICK_MEMBERS')) return; -}) + //} else if (msg.channel.name !== 'bots' && msg.content.startsWith(`${config.prefixes.main}`) && !msg.member.hasPermission('KICK_MEMBERS')) return; +}); // Get bot token -bot.login(config['secret']) \ No newline at end of file +bot.login(config['secret']); \ No newline at end of file diff --git a/app_backup.js b/app_backup.js new file mode 100644 index 0000000..e6e1ec8 --- /dev/null +++ b/app_backup.js @@ -0,0 +1,643 @@ +const fs = require('fs'); +const Discord = require('discord.js'); +const config = require('./config.json'); +const bot = new Discord.Client(); +bot.commands = new Discord.Collection(); +const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js')); +const isImageUrl = require('is-image-url'); +const emoji = require('emoji-random'); +const atquotes = require('at-quotes'); +const ytdl = require('ytdl-core'); + +for (const file of commandFiles) { + const command = require(`./commands/${file}`); + + // set a new item in the Collection + // with the key as the command name and the value as the exported module + bot.commands.set(command.name, command); +} + +bot.on('ready', () => { + console.log(`Started bot: ${bot.user.tag} (ID: ${bot.user.id})\nCurrently running on ${bot.guilds.size} server(s).`); // Startup dialouge in output console + bot.user.setActivity('psycho~ uwu', { // Set status + type: 'LISTENING' + }); + + // Outputs available commands in output console + //commands = ['bot', 'help']; + //console.log(commands); +}); + +// Outputs errors in console window +bot.on('error', console.error); + +// Start Bot Commands +bot.on('message', async msg => { + //console.log(msg.content.toLowerCase()); + if (msg.channel.name === 'bots' || msg.channel.name === 'bot-commands' || msg.member.hasPermission('KICK_MEMBERS')) { + // var msgContent = msg.content.toLowerCase(); + // if (prefixCheck()) { + // console.log(msg.member.user.tag, 'says', msgContent, 'in #' + msg.channel.name); + // } + //console.log(config.prefixes.main); + + // Check prefixies in config.json + function prefixCheck() { + if (msgContent.startsWith(config.prefixes.main)) { + return "main"; + } else if (msgContent.startsWith(config.prefixes.alt)) { + return "alt1"; + } else if (msgContent.startsWith(config.prefixes.alt2)) { + return "alt2"; + } else if (msgContent.startsWith(config.prefixes.alt3)) { + return "alt3"; + } else if (msgContent.startsWith(config.prefixes.alt4)) { + return "alt4"; + } else if (msgContent.startsWith(config.prefixes.alt5)) { + return "alt5"; + } else if (msgContent.startsWith(config.prefixes.alt6)) { + return "alt6"; + } else if (msgContent.startsWith(config.prefixes.alt6b)) { + return "alt6b"; + } + } + + if (prefixCheck() == "main") { + var args = msg.content.slice(config.prefixes.main.length).split(/ +/); + var command = args.shift().toLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.main)) return; + } else if (prefixCheck() == "alt1") { + var args = msg.content.slice(config.prefixes.alt.length).split(/ +/); + var command = args.shift().toLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt)) return; + } else if (prefixCheck() == "alt2") { + var args = msg.content.slice(config.prefixes.alt2.length).split(/ +/); + var command = args.shift().toLocaleLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt2)) return; + } else if (prefixCheck() == "alt3") { + var args = msg.content.slice(config.prefixes.alt3.length).split(/ +/); + var command = args.shift().toLocaleLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt3)) return; + } else if (prefixCheck() == "alt4") { + var args = msg.content.slice(config.prefixes.alt4.length).split(/ +/); + var command = args.shift().toLocaleLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4)) return; + } else if (prefixCheck() == "alt5") { + var args = msg.content.slice(config.prefixes.alt4.length).split(/ +/); + var command = args.shift().toLocaleLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4)) return; + } else if (prefixCheck() == "alt6") { + var args = msg.content.slice(config.prefixes.alt4.length).split(/ +/); + var command = args.shift().toLocaleLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4)) return; + } else if (prefixCheck() == "alt6b") { + var args = msg.content.slice(config.prefixes.alt4b.length).split(/ +/); + var command = args.shift().toLocaleLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4b)) return; + } + + // Returns ping of bot + + function noArgs() { + msg.channel.send(`invalid argument(s). type \`${config.prefixes.main}help\` for more information.`); + } + + function noCommand() { + msg.channel.send(`invalid or unspecified command. type \`${config.prefixes.main}help\`.`); + } + + function perms(p) { + if (msg.member.hasPermission(p)) return true; + } + + // 8ball feature + if (command == '8ball' || command == 'ball' || command == '8b') { + r = ['yes~ uwu', 'no.', 'yes!', 'no!', 'what, no.', 'yes.', 'maybe.', 'perhaps.', 'try again.', 'i\'m not sure.']; + + var s = r[Math.floor(Math.random() * r.length)]; + + emb = new Discord.RichEmbed() + + .setAuthor('the 8-ball says', 'https://upload.wikimedia.org/wikipedia/commons/thumb/f/fd/8-Ball_Pool.svg/500px-8-Ball_Pool.svg.png') + .setDescription('`' + s + '`'); + + msg.channel.send(RichEmbed = emb); + } + + // Say feature, bot repeats what you say + if (command == 'say') { + if (msg.member.hasPermission('KICK_MEMBERS')) { + m = args.join(' '); + msg.channel.send(m); + msg.delete(); + } + } + + // Server info feature + if (command == 'server' || command == 'serverinfo') { + var o = msg.guild.members.filter(m => m.presence.status === 'online').size; + + emb = new Discord.RichEmbed() + + .setAuthor(`${msg.guild.name} - ${msg.guild.id}`, `${msg.guild.iconURL}`, `https://discordapp.com/channels/${msg.guild.id}/${msg.guild.id}`) + .setDescription(`here\'s all the information on \`${msg.guild.name}\``) + .setThumbnail(`${msg.guild.iconURL}`) + .addField('owner', `${msg.guild.owner}`, false) + .addField(`members [${msg.guild.memberCount}]`, `${o} members are online.`, true) + .addField('region', `${msg.guild.region}`, true) + .addField('text channels', `${msg.guild.channels.filter(c => c.type === 'text').size}`, true) + .addField('voice channels', `${msg.guild.channels.filter(c => c.type === 'voice').size}`, true) + .addField('guild created', `${msg.guild.createdAt}`, false) + .addField('s5nical joined', `${msg.guild.members.get('695107550403756192').joinedAt}`) + .setColor(0xF97DAE); + + msg.channel.send(RichEmbed = emb); + } + + if (command == 'leave') { + if (msg.guild.voiceConnection) { + msg.guild.voiceConnection.disconnect(); + msg.reply('succesfully left voice channel'); + } else { + msg.reply('i\'m not in a voice channel'); + } + } + + if (command == 'join') { + if (!msg.guild.voiceConnection && msg.member.voiceChannel) { + msg.member.voiceChannel.join(); + msg.reply('succesfully joined voice channel'); + } else if (msg.guild.voiceConnection) { + msg.reply('i\'m already in voice channel'); + } else if (!msg.member.voiceChannel) { + msg.reply('you\'re not in a voice channel'); + } + } + + if (command == 'reboot' | command == 'r') { + msg.member.voiceChannel.join(); + msg.member.voiceChannel.leave(); + msg.reply('reboot finished lol') + } + + /*if (command == 'pause') { + dispatcher.pause(); + } + + if (command == 'resume' || 'play') { + dispatcher.resume(); + } + + if (command == 'volume' || 'vol') { + + }*/ + + // Play mario on a bike + if (command == 'abee' || command == 'a-bee') { + if (msg.member.voiceChannel && !msg.guild.voiceConnection) { + const connection = await msg.member.voiceChannel.join(); + const dispatcher = connection.playFile('./assets/audio/mario_on_a_bike.mp3', { + volume: 0.5 + }); + + dispatcher.on('end', () => { + msg.member.voiceChannel.leave(); + }) + } else if (msg.guild.voiceConnection) { + msg.reply('i\'m already playing that lol') + } else { + msg.reply('you need to join a voice channel first silly'); + } + } + + // Play squeak on a bike + if (command == 'squeak') { + if (msg.member.voiceChannel && !msg.guild.voiceConnection) { + const connection = await msg.member.voiceChannel.join(); + const dispatcher = connection.playFile('./assets/audio/squeak.wav', { + volume: 0.2 + }); + + dispatcher.on('end', () => { + msg.member.voiceChannel.leave(); + }) + } else if (msg.guild.voiceConnection) { + msg.reply('i\'m already playing that lol') + } else { + msg.reply('you need to join a voice channel first silly'); + } + } + + // Play uhhhh + if (command == 'uhhhh') { + if (msg.member.voiceChannel && !msg.guild.voiceConnection) { + const connection = await msg.member.voiceChannel.join(); + const dispatcher = connection.playFile('./assets/audio/uhhhh.wav', { + volume: 0.5 + }); + + dispatcher.on('end', () => { + msg.member.voiceChannel.leave(); + }) + } else if (msg.guild.voiceConnection) { + msg.reply('i\'m already playing that lol') + } else { + msg.reply('you need to join a voice channel first silly'); + } + } + + // Plays Mase - Psycho + if (command == 'psycho') { + if (msg.member.voiceChannel && !msg.guild.voiceConnection) { + const connection = await msg.member.voiceChannel.join(); + const dispatcher = connection.playFile('./assets/audio/mase_psycho.mp3', { + volume: 0.5 + }); + + dispatcher.on('end', () => { + msg.member.voiceChannel.leave(); + }) + } else if (msg.guild.voiceConnection) { + msg.reply('i\'m already playing that lol') + } else { + msg.reply('you need to join a voice channel first silly'); + } + } + + if (command == 'fart') { + if (msg.member.voiceChannel && !msg.guild.voiceConnection) { + const connection = await msg.member.voiceChannel.join(); + var fartNum = Math.floor((Math.random() * 8) + 1); + + if (fartNum == 1) { + msg.reply('you got fart 1, courtesy of Sin') + const dispatcher = connection.playFile('./assets/audio/farts/1.mp3', { + volume: 0.5 + }); + dispatcher.on('end', () => { + msg.member.voiceChannel.leave(); + }) + } else if (fartNum == 2) { + msg.reply('you got fart 2, courtesy of Sin') + const dispatcher = connection.playFile('./assets/audio/farts/2.mp3', { + volume: 0.5 + }); + dispatcher.on('end', () => { + msg.member.voiceChannel.leave(); + }) + } else if (fartNum == 3) { + msg.reply('you got fart 3, courtesy of Sin') + const dispatcher = connection.playFile('./assets/audio/farts/3.mp3', { + volume: 0.5 + }); + dispatcher.on('end', () => { + msg.member.voiceChannel.leave(); + }) + } else if (fartNum == 4) { + msg.reply('you got fart 4, courtesy of Sin') + const dispatcher = connection.playFile('./assets/audio/farts/4.mp3', { + volume: 0.5 + }); + dispatcher.on('end', () => { + msg.member.voiceChannel.leave(); + }) + } else if (fartNum == 5) { + msg.reply('you got fart 5, courtesy of Sin') + const dispatcher = connection.playFile('./assets/audio/farts/5.mp3', { + volume: 0.5 + }); + dispatcher.on('end', () => { + msg.member.voiceChannel.leave(); + }) + } else if (fartNum == 6) { + msg.reply('you got fart 6, courtesy of nick') + const dispatcher = connection.playFile('./assets/audio/farts/6.mp3', { + volume: 0.5 + }); + dispatcher.on('end', () => { + msg.member.voiceChannel.leave(); + }) + } else if (fartNum == 7) { + msg.reply('you got fart 7, courtesy of nick') + const dispatcher = connection.playFile('./assets/audio/farts/7.mp3', { + volume: 0.5 + }); + dispatcher.on('end', () => { + msg.member.voiceChannel.leave(); + }) + } else if (fartNum == 8) { + msg.reply('you got fart 8, courtesy of nick') + const dispatcher = connection.playFile('./assets/audio/farts/8.mp3', { + volume: 0.5 + }); + dispatcher.on('end', () => { + msg.member.voiceChannel.leave(); + }) + } + } else if (msg.guild.voiceConnection) { + msg.reply('i\'m already playing that lol') + } else { + msg.reply('you need to join a voice channel first silly'); + } + } + + if (command == 'wahoo' | command == 'frozen' | command == 'frozenyyy') { + if (msg.member.voiceChannel && !msg.guild.voiceConnection) { + const connection = await msg.member.voiceChannel.join(); + const dispatcher = connection.playFile('./assets/audio/wahoo.mp3', { + volume: 1.0 + }); + + dispatcher.on('end', () => { + msg.member.voiceChannel.leave(); + }) + } else if (msg.guild.voiceConnection) { + msg.reply('i\'m already playing that lol') + } else { + msg.reply('you need to join a voice channel first silly'); + } + } + + if (command == 'yt-test') { + if (msg.member.voiceChannel && !msg.guild.voiceConnection) { + const connection = await msg.member.voiceChannel.join(); + const stream = ytdl('https://www.youtube.com/watch?v=3CS93CdMv_E', { filter: 'audioonly' }); + const dispatcher = connection.playStream(stream, { + volume: 0.5 + }); + + dispatcher.on('end', () => { + msg.member.voiceChannel.leave(); + }) + } else if (msg.guild.voiceConnection) { + msg.reply('i\'m already playing that lol') + } else { + msg.reply('you need to join a voice channel first silly'); + } + } + + // Help + if (command == 'help') { + if (!args.length) { + let emb = new Discord.RichEmbed() + + .setThumbnail(`${msg.guild.iconURL}`) + .setDescription(` + **command list**\nlink not yet set lol\n\n**categories list:**\n\`s5n!help \`\n\n**full list**\n\`s5n!commands\` + `) + .setColor(0xF97DAE); + + msg.channel.send(RichEmbed = emb); + } else if (args[0] == 'quotes' || args[0] == 'quote') { + let emb = new Discord.RichEmbed() + + .setTitle('quotes -> quote command: (server only)') + .setThumbnail(`${msg.guild.iconURL}`) + .setDescription(`says random quote from adventure time`) + .addField('details', `says random quote from adventure time +no argument: says a quote from any of the adventure time characters. +finn: says a quote from finn from adventure time. +jake: says a quote from jake from adventure time. +ice-king: says a quote from ice king from adventure time.`, false) + .addField(`format`, `\`s5n!quote [finn | jake | ice-king]\``, true) + .addField('examples', `\`s5n!quote\` - says a random quote any of the adventure time characters +\`s5n!quote finn\` - says a quote from finn from adventure time`, false) + .setFooter('<> - required, | - either/or, {} - optional') + .setColor(0xF97DAE); + + msg.channel.send(RichEmbed = emb); + } + } + + // Commands which you get directed to from help + if (command == 'commands') { + let emb = new Discord.RichEmbed() + + .setAuthor('s5nical\'s commands', `${msg.guild.iconURL}`) + .setThumbnail(`${msg.guild.iconURL}`) + .setDescription(`to view the commands in each group use:\n\`s5n!commands \``) + .addField(`:shield: moderation`, '13 commands.', true) + .addField(`:robot: automation`, '5 commands.', true) + .addField(`:gem: features`, '8 commands.', true) + .addField(`:lock: permissions`, '10 commands.', true) + .addField(`:mag_right: search`, '14 commands.', true) + .addField(`:wrench: utlity`, '20 commands.', true) + .addField(`:information_source: information`, '6 commands.', true) + .addField(`:smirk: fun`, '17 commands.', true) + .addField(`:moneybag: economy`, '8 commands.', true) + .addField(`:game_die: gambling`, '3 commands.', true) + .addField(`:smiley: profiles`, '4 commands.', true) + .addField(`:hammer_pick: skills`, '4 commands.', true) + .addField(`:frame_photo: image`, '3 commands.', true) + .addField(`:blue_heart: reaction`, '8 commands.', true) + .addField(`:chart_with_upwards_trend: counter`, '9 commands.', true) + .addField(`:sailboat: ship`, '2 commands.', true) + .setColor(0xF97DAE); + + msg.channel.send(RichEmbed = emb); + } + + // Member count + if (command == 'membercount' || command == 'memberc' || command == 'mcount' || command == 'mc') { + msg.reply(`there are **${msg.guild.memberCount}** members in **${msg.guild.name}**`); + } + + // Spits out random emoji + if (command == 'moji' || command == 'emoji') { + msg.reply(emoji.random()); + } + + // Spits out random quotes from Adventure TIme + if (command == 'quote' || command == 'quotes') { + if (!args.length) { + msg.reply(atquotes.getQuote()); + } else if (args[0] == 'finn') { + msg.reply(atquotes.getFinnQuote()); + } else if (args[0] == 'jake') { + msg.reply(atquotes.getJakeQuote()); + } else if (args[0] == 'ice-king') { + msg.reply(atquotes.getIceKingQuote()); + } + } + + // Clear/ delete messages in bulk command + if (command == 'clear' || command == 'delete' || command == 'del' || command == 'c') { + if (msg.member.hasPermission('MANAGE_MESSAGES')) { + if (!args) { + msg.reply('you haven\'t specified an amount of messages which should be deleted.').then(deleteNotificationMessage => { + deleteNotificationMessage.delete(1000); + }); + } else if (isNaN(args)) { + msg.reply('the amount parameter isn\'t a number.').then(deleteNotificationMessage => { + deleteNotificationMessage.delete(1000); + }); + } else if (args > 100) { + msg.reply('you can\'t delete more than 100 messages at once.').then(deleteNotificationMessage => { + deleteNotificationMessage.delete(1000); + }); + } else if (args < 1) { + msg.reply('you have to delete at least 1 message.').then(deleteNotificationMessage => { + deleteNotificationMessage.delete(1000); + }); + } /*else if (msg.createdTimestamp > 1209600) { + msg.reply('due to discord rules, bots can only bulk delete messages that are under 14 days old :(') + } */ + else { + var clearAmount = parseInt(args[0]) + 1 + // It took me so long to figure out why this was not really working. It would delete but an insane amount at a time. + // I realized that because it was getting parsed as a string, it would just add 1 to it so if I tried to delete 1 + // message, it would delete 11 lol. Fixed by parsing as integer THEN adding one. 02:30 2020/04/03/2020 + + await msg.channel.fetchMessages({ limit: clearAmount }).then(messages => { // I am on v11 discord.js + msg.channel.bulkDelete(messages); + }); + msg.reply('it\'s been deleted ~uwu').then(deleteNotificationMessage => { + deleteNotificationMessage.delete(1000); + }); + } + } else { + msg.reply('insufficent perms bruh'); + } + } + + if (command == 'dm') { + if (msg.author) { // TODO: fix discord not evaluating args[1] + if (!msg.mentions.users.first() && !args[1]) { + msg.reply('you haven\'t specified a user or a message.') + } else if (!args[1]) { + msg.reply('you haven\'t specified anything to send.') + } else if (!msg.mentions.users.first()) { + msg.reply('you haven\'t specified anyone to send a dm to.') + } else { + var sendTo = msg.mentions.users.first().id; + var d = new Date(msg.createdTimestamp); + + msg.guild.fetchMember(sendTo, false).then(messageUser => { + messageUser.send(args[0]) + + let emb = new Discord.RichEmbed() + + //.setDescription(`to view the commands in each group use:\n\`s5n!commands \``) + .addField(`message`, args[1], true) + .addField(`recipient`, args[0], true) + .addField(`time sent`, d) + .setColor(0xF97DAE); + + msg.channel.send(RichEmbed = emb); + }) + } + + // This shit took about an hour and a half to debug because I couldn't figure out how to convert the first arguement into + // a user id. After getting help from discord.js Discord I fixed it for about 30 seconds at 21:26 and then I broke it again instantlly + // after. Then I tried to fix everything and I almost broke everything again but I realized it was broken because I did s5n!dm instead + // of s5n!test and I hadn't ported the code over from test to. 2020/04/02, 21:34 + //where sendTo and d went + //args[0] = args[0].id + //msg.reply(args[0]); + // args[0]; + + // msg.reply(typeof args[0]) // for debugging + + // const collector = new Discord.MessageCollector(msg.channel, m => m.author.id === msg.author.id, { + // time: 5000 + // }); + // msg.reply('timed out', 5000) + // //console.log(collector) + + // collector.on('collect', message => { + // var messageText = message.content; + + // if (msg.member.message) { + // msg.reply('received') + // } + // }) + + // msg.reply('what would you like to say?'); + // if (msg.member.lastMessage) { + // var messageText = msg.member.lastMessage.content; + // } + + // where send function went + } else { + msg.reply('insufficent perms bruh'); + } + } + + if (msg.mentions.everyone) { + msg.react(':ArisaPing:695887537390223402'); + } + + /*if (command == 'botstatus' || command == 'status' || command == 'bs') { + if (msg.member.hasPermission('KICK_MEMBERS')) { + if (!args) { + msg.reply('no status specified') + } + + if (args == 'online') { + bot.user.setStatus("online"); + } else if (args == 'idle') { + bot.user.setStatus("idle"); + } else if (args == 'dnd') { + bot.user.setStatus("dnd"); + } else if (args == 'invisable') { + bot.user.setStatus("invisable"); + } + } else { + msg.reply('insufficent perms bruh'); + } + }*/ + + // Change status and status message + /*if (command == 'botstatus' || command == 'status' || command == 'bs') { + if (msg.member.hasPermission('KICK_MEMBERS')) { + if (!args[0] && !args[1]) { + msg.reply('you haven\'t specified a status or a message.') + } else if (!args[1]) { + msg.reply('you haven\'t specified a message.') + } else if (!args[0]) { + msg.reply('you haven\'t specified a status.') + } else { + status = args[0].toLocaleUpperCase(); + var d = new Date(msg.createdTimestamp); + + bot.user.setActivity(args[1], { + type: status + }); + + let emb = new Discord.RichEmbed() + + //.setDescription(`to view the commands in each group use:\n\`s5n!commands \``) + .addField(`status message`, args[1], true) + .addField(`status`, status, true) + .addField(`time changed`, d) + .setColor(0xF97DAE); + + msg.channel.send(RichEmbed = emb); + } + } + }*/ + + /*function joinCheck() { + switch (msg.guild.voiceConnection) { + case !msg.guild.voiceConnection && msg.member.voiceChannel: + msg.member.voiceChannel.join(); + msg.reply('succesfully joined voice channel') + case (msg.guild.voiceConnection): + msg.reply('i\'m already in voice channel') + case (!msg.member.voiceChannel): + msg.reply('you\'re not in a voice channel') + } + }*/ + } else if (msg.channel.name !== 'bots' && msg.content.startsWith(`${config.prefixes.main}`) && !msg.member.hasPermission('KICK_MEMBERS')) return; +}) + +// Get bot token +bot.login(config['secret']) \ No newline at end of file diff --git a/app_legacy.js b/app_legacy.js new file mode 100644 index 0000000..2cf52dd --- /dev/null +++ b/app_legacy.js @@ -0,0 +1,358 @@ +const Discord = require('discord.js'); +const config = require('./config.json'); +const bot = new Discord.Client(); +const isImageUrl = require('is-image-url'); +const emoji = require('emoji-random'); +const atquotes = require('at-quotes'); +const ytdl = require('ytdl-core'); + +bot.on('ready', () => { + console.log(`Started bot: ${bot.user.tag} (ID: ${bot.user.id})\nCurrently running on ${bot.guilds.size} server(s).`); // Startup dialouge in output console + bot.user.setActivity('psycho~ uwu', { // Set status + type: 'LISTENING' + }); + + // Outputs available commands in output console + //commands = ['bot', 'help']; + //console.log(commands); +}); + +// Outputs errors in console window +bot.on('error', console.error); + +// Start Bot Commands +bot.on('message', async msg => { + //console.log(msg.content.toLowerCase()); + if (msg.channel.name === 'bots' || msg.channel.name === 'bot-commands' || msg.member.hasPermission('KICK_MEMBERS')) { + var msgContent = msg.content.toLowerCase(); + if (prefixCheck()) { + console.log(msg.member.user.tag, 'says', msgContent, 'in #' + msg.channel.name); + } + //console.log(config.prefixes.main); + + // Check prefixies in config.json + function prefixCheck() { + if (msgContent.startsWith(config.prefixes.main)) { + return "main"; + } else if (msgContent.startsWith(config.prefixes.alt)) { + return "alt1"; + } else if (msgContent.startsWith(config.prefixes.alt2)) { + return "alt2"; + } else if (msgContent.startsWith(config.prefixes.alt3)) { + return "alt3"; + } else if (msgContent.startsWith(config.prefixes.alt4)) { + return "alt4"; + } else if (msgContent.startsWith(config.prefixes.alt5)) { + return "alt5"; + } else if (msgContent.startsWith(config.prefixes.alt6)) { + return "alt6"; + } else if (msgContent.startsWith(config.prefixes.alt6b)) { + return "alt6b"; + } + } + + if (prefixCheck() == "main") { + var args = msg.content.slice(config.prefixes.main.length).split(/ +/); + var command = args.shift().toLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.main)) return; + } else if (prefixCheck() == "alt1") { + var args = msg.content.slice(config.prefixes.alt.length).split(/ +/); + var command = args.shift().toLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt)) return; + } else if (prefixCheck() == "alt2") { + var args = msg.content.slice(config.prefixes.alt2.length).split(/ +/); + var command = args.shift().toLocaleLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt2)) return; + } else if (prefixCheck() == "alt3") { + var args = msg.content.slice(config.prefixes.alt3.length).split(/ +/); + var command = args.shift().toLocaleLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt3)) return; + } else if (prefixCheck() == "alt4") { + var args = msg.content.slice(config.prefixes.alt4.length).split(/ +/); + var command = args.shift().toLocaleLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4)) return; + } else if (prefixCheck() == "alt5") { + var args = msg.content.slice(config.prefixes.alt4.length).split(/ +/); + var command = args.shift().toLocaleLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4)) return; + } else if (prefixCheck() == "alt6") { + var args = msg.content.slice(config.prefixes.alt4.length).split(/ +/); + var command = args.shift().toLocaleLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4)) return; + } else if (prefixCheck() == "alt6b") { + var args = msg.content.slice(config.prefixes.alt4b.length).split(/ +/); + var command = args.shift().toLocaleLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4b)) return; + } + + // Returns ping of bot + if (command == 'ping' || command == 'ms') { + const t = Date.now(); + + msg.channel.send('plz wait..').then(m => { + m.edit(`** **`); + + const n = Date.now(); + let emb = new Discord.RichEmbed() + + .setDescription(`pong! s5nical's is \`${n - t}ms\`. heartbeat \`${bot.ping}ms\`.`) + .setColor(0xF97DAE); + + msg.channel.send(RichEmbed = emb); + }); + } + + function noArgs() { + msg.channel.send(`invalid argument(s). type \`${config.prefixes.main}help\` for more information.`); + } + + function noCommand() { + msg.channel.send(`invalid or unspecified command. type \`${config.prefixes.main}help\`.`); + } + + function perms(p) { + if (msg.member.hasPermission(p)) return true; + } + + /*if (command == 'pause') { + dispatcher.pause(); + } + + if (command == 'resume' || 'play') { + dispatcher.resume(); + } + + if (command == 'volume' || 'vol') { + + }*/ + + // Plays Mase - Psycho + if (command == 'psycho') { + if (msg.member.voiceChannel && !msg.guild.voiceConnection) { + const connection = await msg.member.voiceChannel.join(); + const dispatcher = connection.playFile('./assets/audio/mase_psycho.mp3', { + volume: 0.5 + }); + + dispatcher.on('end', () => { + msg.member.voiceChannel.leave(); + }) + } else if (msg.guild.voiceConnection) { + msg.reply('i\'m already playing that lol') + } else { + msg.reply('you need to join a voice channel first silly'); + } + } + + if (command == 'yt-test') { + if (msg.member.voiceChannel && !msg.guild.voiceConnection) { + const connection = await msg.member.voiceChannel.join(); + const stream = ytdl('https://www.youtube.com/watch?v=3CS93CdMv_E', { filter: 'audioonly' }); + const dispatcher = connection.playStream(stream, { + volume: 0.5 + }); + + dispatcher.on('end', () => { + msg.member.voiceChannel.leave(); + }) + } else if (msg.guild.voiceConnection) { + msg.reply('i\'m already playing that lol') + } else { + msg.reply('you need to join a voice channel first silly'); + } + } + + // Spits out random quotes from Adventure TIme + if (command == 'quote' || command == 'quotes') { + if (!args.length) { + msg.reply(atquotes.getQuote()); + } else if (args[0] == 'finn') { + msg.reply(atquotes.getFinnQuote()); + } else if (args[0] == 'jake') { + msg.reply(atquotes.getJakeQuote()); + } else if (args[0] == 'ice-king') { + msg.reply(atquotes.getIceKingQuote()); + } + } + + // Clear/ delete messages in bulk command + if (command == 'clear' || command == 'delete' || command == 'del' || command == 'c') { + if (msg.member.hasPermission('MANAGE_MESSAGES')) { + if (!args) { + msg.reply('you haven\'t specified an amount of messages which should be deleted.').then(deleteNotificationMessage => { + deleteNotificationMessage.delete(1000); + }); + } else if (isNaN(args)) { + msg.reply('the amount parameter isn\'t a number.').then(deleteNotificationMessage => { + deleteNotificationMessage.delete(1000); + }); + } else if (args > 100) { + msg.reply('you can\'t delete more than 100 messages at once.').then(deleteNotificationMessage => { + deleteNotificationMessage.delete(1000); + }); + } else if (args < 1) { + msg.reply('you have to delete at least 1 message.').then(deleteNotificationMessage => { + deleteNotificationMessage.delete(1000); + }); + } /*else if (msg.createdTimestamp > 1209600) { + msg.reply('due to discord rules, bots can only bulk delete messages that are under 14 days old :(') + } */ + else { + var clearAmount = parseInt(args[0]) + 1 + // It took me so long to figure out why this was not really working. It would delete but an insane amount at a time. + // I realized that because it was getting parsed as a string, it would just add 1 to it so if I tried to delete 1 + // message, it would delete 11 lol. Fixed by parsing as integer THEN adding one. 02:30 2020/04/03/2020 + + await msg.channel.fetchMessages({ limit: clearAmount }).then(messages => { // I am on v11 discord.js + msg.channel.bulkDelete(messages); + }); + msg.reply('it\'s been deleted ~uwu').then(deleteNotificationMessage => { + deleteNotificationMessage.delete(1000); + }); + } + } else { + msg.reply('insufficent perms bruh'); + } + } + + if (command == 'dm') { + if (msg.author) { // TODO: fix discord not evaluating args[1] + if (!msg.mentions.users.first() && !args[1]) { + msg.reply('you haven\'t specified a user or a message.') + } else if (!args[1]) { + msg.reply('you haven\'t specified anything to send.') + } else if (!msg.mentions.users.first()) { + msg.reply('you haven\'t specified anyone to send a dm to.') + } else { + var sendTo = msg.mentions.users.first().id; + var d = new Date(msg.createdTimestamp); + + msg.guild.fetchMember(sendTo, false).then(messageUser => { + messageUser.send(args[0]) + + let emb = new Discord.RichEmbed() + + //.setDescription(`to view the commands in each group use:\n\`s5n!commands \``) + .addField(`message`, args[1], true) + .addField(`recipient`, args[0], true) + .addField(`time sent`, d) + .setColor(0xF97DAE); + + msg.channel.send(RichEmbed = emb); + }) + } + + // This shit took about an hour and a half to debug because I couldn't figure out how to convert the first arguement into + // a user id. After getting help from discord.js Discord I fixed it for about 30 seconds at 21:26 and then I broke it again instantlly + // after. Then I tried to fix everything and I almost broke everything again but I realized it was broken because I did s5n!dm instead + // of s5n!test and I hadn't ported the code over from test to. 2020/04/02, 21:34 + //where sendTo and d went + //args[0] = args[0].id + //msg.reply(args[0]); + // args[0]; + + // msg.reply(typeof args[0]) // for debugging + + // const collector = new Discord.MessageCollector(msg.channel, m => m.author.id === msg.author.id, { + // time: 5000 + // }); + // msg.reply('timed out', 5000) + // //console.log(collector) + + // collector.on('collect', message => { + // var messageText = message.content; + + // if (msg.member.message) { + // msg.reply('received') + // } + // }) + + // msg.reply('what would you like to say?'); + // if (msg.member.lastMessage) { + // var messageText = msg.member.lastMessage.content; + // } + + // where send function went + } else { + msg.reply('insufficent perms bruh'); + } + } + + if (msg.mentions.everyone) { + msg.react(':ArisaPing:695887537390223402'); + } + + /*if (command == 'botstatus' || command == 'status' || command == 'bs') { + if (msg.member.hasPermission('KICK_MEMBERS')) { + if (!args) { + msg.reply('no status specified') + } + + if (args == 'online') { + bot.user.setStatus("online"); + } else if (args == 'idle') { + bot.user.setStatus("idle"); + } else if (args == 'dnd') { + bot.user.setStatus("dnd"); + } else if (args == 'invisable') { + bot.user.setStatus("invisable"); + } + } else { + msg.reply('insufficent perms bruh'); + } + }*/ + + // Change status and status message + /*if (command == 'botstatus' || command == 'status' || command == 'bs') { + if (msg.member.hasPermission('KICK_MEMBERS')) { + if (!args[0] && !args[1]) { + msg.reply('you haven\'t specified a status or a message.') + } else if (!args[1]) { + msg.reply('you haven\'t specified a message.') + } else if (!args[0]) { + msg.reply('you haven\'t specified a status.') + } else { + status = args[0].toLocaleUpperCase(); + var d = new Date(msg.createdTimestamp); + + bot.user.setActivity(args[1], { + type: status + }); + + let emb = new Discord.RichEmbed() + + //.setDescription(`to view the commands in each group use:\n\`s5n!commands \``) + .addField(`status message`, args[1], true) + .addField(`status`, status, true) + .addField(`time changed`, d) + .setColor(0xF97DAE); + + msg.channel.send(RichEmbed = emb); + } + } + }*/ + + /*function joinCheck() { + switch (msg.guild.voiceConnection) { + case !msg.guild.voiceConnection && msg.member.voiceChannel: + msg.member.voiceChannel.join(); + msg.reply('succesfully joined voice channel') + case (msg.guild.voiceConnection): + msg.reply('i\'m already in voice channel') + case (!msg.member.voiceChannel): + msg.reply('you\'re not in a voice channel') + } + }*/ + } else if (msg.channel.name !== 'bots' && msg.content.startsWith(`${config.prefixes.main}`) && !msg.member.hasPermission('KICK_MEMBERS')) return; +}) + +// Get bot token +bot.login(config['secret']) \ No newline at end of file diff --git a/commands/8ball.js b/commands/8ball.js new file mode 100644 index 0000000..e8e3e4a --- /dev/null +++ b/commands/8ball.js @@ -0,0 +1,19 @@ +const Discord = require('discord.js'); + +module.exports = { + name: '8ball', + aliases: ['ball', '8b'], + description: '', + execute(msg) { + r = ['yes~ uwu', 'no.', 'yes!', 'no!', 'what, no.', 'yes.', 'maybe.', 'perhaps.', 'try again.', 'i\'m not sure.']; + + var s = r[Math.floor(Math.random() * r.length)]; + + emb = new Discord.RichEmbed() + + .setAuthor('the 8-ball says', 'https://upload.wikimedia.org/wikipedia/commons/thumb/f/fd/8-Ball_Pool.svg/500px-8-Ball_Pool.svg.png') + .setDescription('`' + s + '`'); + + msg.channel.send(RichEmbed = emb); + } +} \ No newline at end of file diff --git a/commands/abee.js b/commands/abee.js new file mode 100644 index 0000000..c665b12 --- /dev/null +++ b/commands/abee.js @@ -0,0 +1,21 @@ +module.exports = { + name: 'abee', + aliases: ['a-bee'], + description: '', + async execute(msg) { + if (msg.member.voiceChannel && !msg.guild.voiceConnection) { + const connection = await msg.member.voiceChannel.join(); + const dispatcher = connection.playFile('./assets/audio/mario_on_a_bike.mp3', { + volume: 0.5 + }); + + dispatcher.on('end', () => { + msg.member.voiceChannel.leave(); + }); + } else if (msg.guild.voiceConnection) { + msg.reply('i\'m already playing that lol'); + } else { + msg.reply('you need to join a voice channel first silly'); + } + } +} \ No newline at end of file diff --git a/commands/clear.js b/commands/clear.js new file mode 100644 index 0000000..90eef2e --- /dev/null +++ b/commands/clear.js @@ -0,0 +1,46 @@ +module.exports = { + name: 'clear', + aliases: ['delete', 'del', 'c'], + description: '', + async execute(msg, args, bot) { + if (msg.member.hasPermission('MANAGE_MESSAGES')) { + if (!args) { + msg.reply('you haven\'t specified an amount of messages which should be deleted.').then(deleteNotificationMessage => { + deleteNotificationMessage.delete(1000); + }); + } else if (isNaN(args)) { + msg.reply('the amount parameter isn\'t a number.').then(deleteNotificationMessage => { + deleteNotificationMessage.delete(1000); + }); + } else if (args > 100) { + msg.reply('you can\'t delete more than 100 messages at once.').then(deleteNotificationMessage => { + deleteNotificationMessage.delete(1000); + }); + } else if (args < 1) { + msg.reply('you have to delete at least 1 message.').then(deleteNotificationMessage => { + deleteNotificationMessage.delete(1000); + }); + } + /*else if (msg.createdTimestamp > 1209600) { + msg.reply('due to discord rules, bots can only bulk delete messages that are under 14 days old :(') + } */ + else { + var clearAmount = parseInt(args[0]) + 1; + // It took me so long to figure out why this was not really working. It would delete but an insane amount at a time. + // I realized that because it was getting parsed as a string, it would just add 1 to it so if I tried to delete 1 + // message, it would delete 11 lol. Fixed by parsing as integer THEN adding one. 02:30 2020/04/03/2020 + + await msg.channel.fetchMessages({ + limit: clearAmount + }).then(messages => { // I am on v11 discord.js + msg.channel.bulkDelete(messages); + }); + msg.reply('it\'s been deleted ~uwu').then(deleteNotificationMessage => { + deleteNotificationMessage.delete(1000); + }); + } + } else { + msg.reply('insufficent perms bruh'); + } + } +} \ No newline at end of file diff --git a/commands/commands.js b/commands/commands.js new file mode 100644 index 0000000..e78ae45 --- /dev/null +++ b/commands/commands.js @@ -0,0 +1,32 @@ +const Discord = require('discord.js'); + +module.exports = { + name: 'commands', + description: '', + execute(msg, args, bot) { + let emb = new Discord.RichEmbed() + + .setAuthor('s5nical\'s commands', `${msg.guild.iconURL}`) + .setThumbnail(`${msg.guild.iconURL}`) + .setDescription(`to view the commands in each group use:\n\`s5n!commands \``) + .addField(`:shield: moderation`, '13 commands.', true) + .addField(`:robot: automation`, '5 commands.', true) + .addField(`:gem: features`, '8 commands.', true) + .addField(`:lock: permissions`, '10 commands.', true) + .addField(`:mag_right: search`, '14 commands.', true) + .addField(`:wrench: utlity`, '20 commands.', true) + .addField(`:information_source: information`, '6 commands.', true) + .addField(`:smirk: fun`, '17 commands.', true) + .addField(`:moneybag: economy`, '8 commands.', true) + .addField(`:game_die: gambling`, '3 commands.', true) + .addField(`:smiley: profiles`, '4 commands.', true) + .addField(`:hammer_pick: skills`, '4 commands.', true) + .addField(`:frame_photo: image`, '3 commands.', true) + .addField(`:blue_heart: reaction`, '8 commands.', true) + .addField(`:chart_with_upwards_trend: counter`, '9 commands.', true) + .addField(`:sailboat: ship`, '2 commands.', true) + .setColor(0xF97DAE); + + msg.channel.send(RichEmbed = emb); + } +} \ No newline at end of file diff --git a/commands/dm.js b/commands/dm.js new file mode 100644 index 0000000..edd8a0a --- /dev/null +++ b/commands/dm.js @@ -0,0 +1,66 @@ +module.exports = { + name: 'dm', + description: '', + execute(msg, args, bot) { + if (msg.author) { // TODO: fix discord not evaluating args[1] + if (!msg.mentions.users.first() && !args[1]) { + msg.reply('you haven\'t specified a user or a message.') + } else if (!args[1]) { + msg.reply('you haven\'t specified anything to send.') + } else if (!msg.mentions.users.first()) { + msg.reply('you haven\'t specified anyone to send a dm to.') + } else { + var sendTo = msg.mentions.users.first().id; + var d = new Date(msg.createdTimestamp); + + msg.guild.fetchMember(sendTo, false).then(messageUser => { + messageUser.send(args[0]) + + let emb = new Discord.RichEmbed() + + //.setDescription(`to view the commands in each group use:\n\`s5n!commands \``) + .addField(`message`, args[1], true) + .addField(`recipient`, args[0], true) + .addField(`time sent`, d) + .setColor(0xF97DAE); + + msg.channel.send(RichEmbed = emb); + }); + } + + // This shit took about an hour and a half to debug because I couldn't figure out how to convert the first arguement into + // a user id. After getting help from discord.js Discord I fixed it for about 30 seconds at 21:26 and then I broke it again instantlly + // after. Then I tried to fix everything and I almost broke everything again but I realized it was broken because I did s5n!dm instead + // of s5n!test and I hadn't ported the code over from test to. 2020/04/02, 21:34 + //where sendTo and d went + //args[0] = args[0].id + //msg.reply(args[0]); + // args[0]; + + // msg.reply(typeof args[0]) // for debugging + + // const collector = new Discord.MessageCollector(msg.channel, m => m.author.id === msg.author.id, { + // time: 5000 + // }); + // msg.reply('timed out', 5000) + // //console.log(collector) + + // collector.on('collect', message => { + // var messageText = message.content; + + // if (msg.member.message) { + // msg.reply('received') + // } + // }) + + // msg.reply('what would you like to say?'); + // if (msg.member.lastMessage) { + // var messageText = msg.member.lastMessage.content; + // } + + // where send function went + } else { + msg.reply('insufficent perms bruh'); + } + } +} \ No newline at end of file diff --git a/commands/emoji.js b/commands/emoji.js new file mode 100644 index 0000000..28ab679 --- /dev/null +++ b/commands/emoji.js @@ -0,0 +1,10 @@ +const emoji = require('emoji-random'); + +module.exports = { + name: 'emoji', + aliases: ['moji'], + description: '', + execute(msg, args, bot) { + msg.reply(emoji.random()); + } +} \ No newline at end of file diff --git a/commands/fart.js b/commands/fart.js new file mode 100644 index 0000000..3da3f3b --- /dev/null +++ b/commands/fart.js @@ -0,0 +1,80 @@ +module.exports = { + name: 'fart', + description: '', + async execute(msg, args, bot) { + if (msg.member.voiceChannel && !msg.guild.voiceConnection) { + const connection = await msg.member.voiceChannel.join(); + var fartNum = Math.floor((Math.random() * 8) + 1); + + if (fartNum == 1) { + msg.reply('you got fart 1, courtesy of Sin'); + const dispatcher = connection.playFile('./assets/audio/farts/1.mp3', { + volume: 0.5 + }); + dispatcher.on('end', () => { + msg.member.voiceChannel.leave(); + }) + } else if (fartNum == 2) { + msg.reply('you got fart 2, courtesy of Sin'); + const dispatcher = connection.playFile('./assets/audio/farts/2.mp3', { + volume: 0.5 + }); + dispatcher.on('end', () => { + msg.member.voiceChannel.leave(); + }) + } else if (fartNum == 3) { + msg.reply('you got fart 3, courtesy of Sin'); + const dispatcher = connection.playFile('./assets/audio/farts/3.mp3', { + volume: 0.5 + }); + dispatcher.on('end', () => { + msg.member.voiceChannel.leave(); + }) + } else if (fartNum == 4) { + msg.reply('you got fart 4, courtesy of Sin'); + const dispatcher = connection.playFile('./assets/audio/farts/4.mp3', { + volume: 0.5 + }); + dispatcher.on('end', () => { + msg.member.voiceChannel.leave(); + }) + } else if (fartNum == 5) { + msg.reply('you got fart 5, courtesy of Sin'); + const dispatcher = connection.playFile('./assets/audio/farts/5.mp3', { + volume: 0.5 + }); + dispatcher.on('end', () => { + msg.member.voiceChannel.leave(); + }) + } else if (fartNum == 6) { + msg.reply('you got fart 6, courtesy of nick'); + const dispatcher = connection.playFile('./assets/audio/farts/6.mp3', { + volume: 0.5 + }); + dispatcher.on('end', () => { + msg.member.voiceChannel.leave(); + }) + } else if (fartNum == 7) { + msg.reply('you got fart 7, courtesy of nick'); + const dispatcher = connection.playFile('./assets/audio/farts/7.mp3', { + volume: 0.5 + }); + dispatcher.on('end', () => { + msg.member.voiceChannel.leave(); + }) + } else if (fartNum == 8) { + msg.reply('you got fart 8, courtesy of nick'); + const dispatcher = connection.playFile('./assets/audio/farts/8.mp3', { + volume: 0.5 + }); + dispatcher.on('end', () => { + msg.member.voiceChannel.leave(); + }) + } + } else if (msg.guild.voiceConnection) { + msg.reply('i\'m already playing that lol'); + } else { + msg.reply('you need to join a voice channel first silly'); + } + } +} \ No newline at end of file diff --git a/commands/help.js b/commands/help.js new file mode 100644 index 0000000..4c7ecf0 --- /dev/null +++ b/commands/help.js @@ -0,0 +1,37 @@ +const Discord = require('discord.js'); + +module.exports = { + name: 'help', + description: '', + execute(msg, args, bot) { + if (!args.length) { + let emb = new Discord.RichEmbed() + + .setThumbnail(`${msg.guild.iconURL}`) + .setDescription(` + **command list**\nlink not yet set lol\n\n**categories list:**\n\`s5n!help \`\n\n**full list**\n\`s5n!commands\` + `) + .setColor(0xF97DAE); + + msg.channel.send(RichEmbed = emb); + } else if (args[0] == 'quotes' || args[0] == 'quote') { + let emb = new Discord.RichEmbed() + + .setTitle('quotes -> quote command: (server only)') + .setThumbnail(`${msg.guild.iconURL}`) + .setDescription(`says random quote from adventure time`) + .addField('details', `says random quote from adventure time +no argument: says a quote from any of the adventure time characters. +finn: says a quote from finn from adventure time. +jake: says a quote from jake from adventure time. +ice-king: says a quote from ice king from adventure time.`, false) + .addField(`format`, `\`s5n!quote [finn | jake | ice-king]\``, true) + .addField('examples', `\`s5n!quote\` - says a random quote any of the adventure time characters +\`s5n!quote finn\` - says a quote from finn from adventure time`, false) + .setFooter('<> - required, | - either/or, {} - optional') + .setColor(0xF97DAE); + + msg.channel.send(RichEmbed = emb); + } + } +} \ No newline at end of file diff --git a/commands/join.js b/commands/join.js new file mode 100644 index 0000000..15ef1de --- /dev/null +++ b/commands/join.js @@ -0,0 +1,15 @@ +module.exports = { + name: 'join', + aliases: ['j'], + description: '', + execute(msg, args, bot) { + if (!msg.guild.voiceConnection && msg.member.voiceChannel) { + msg.member.voiceChannel.join(); + msg.reply('succesfully joined voice channel'); + } else if (msg.guild.voiceConnection) { + msg.reply('i\'m already in voice channel'); + } else if (!msg.member.voiceChannel) { + msg.reply('you\'re not in a voice channel'); + } + } +} \ No newline at end of file diff --git a/commands/leave.js b/commands/leave.js new file mode 100644 index 0000000..51fac82 --- /dev/null +++ b/commands/leave.js @@ -0,0 +1,12 @@ +module.exports = { + name: 'leave', + description: '', + execute(msg, args, bot) { + if (msg.guild.voiceConnection) { + msg.guild.voiceConnection.disconnect(); + msg.reply('succesfully left voice channel'); + } else { + msg.reply('i\'m not in a voice channel'); + } + } +} \ No newline at end of file diff --git a/commands/membercount.js b/commands/membercount.js new file mode 100644 index 0000000..7c32f16 --- /dev/null +++ b/commands/membercount.js @@ -0,0 +1,8 @@ +module.exports = { + name: 'membercount', + aliases: ['memberc', 'mcount', 'mc'], + description: '', + execute(msg, args, bot) { + msg.reply(`there are **${msg.guild.memberCount}** members in **${msg.guild.name}**`); + } +} \ No newline at end of file diff --git a/commands/ping.js b/commands/ping.js new file mode 100644 index 0000000..b881170 --- /dev/null +++ b/commands/ping.js @@ -0,0 +1,21 @@ +const Discord = require('discord.js'); + +module.exports = { + name: 'ping', + description: '', + execute(msg, args, bot) { + const t = Date.now(); + + msg.channel.send('plz wait..').then(m => { + m.edit(`** **`); + + const n = Date.now(); + let emb = new Discord.RichEmbed() + + .setDescription(`pong! s5nical's is \`${n - t}ms\`. heartbeat \`${bot.ping}ms\`.`) + .setColor(0xF97DAE); + + msg.channel.send(RichEmbed = emb); + }); + } +} \ No newline at end of file diff --git a/commands/quote.js b/commands/quote.js new file mode 100644 index 0000000..8b182e6 --- /dev/null +++ b/commands/quote.js @@ -0,0 +1,18 @@ +const atquotes = require('at-quotes'); + +module.exports = { + name: 'quote', + aliases: ['quotes'], + description: '', + execute(msg, args, bot) { + if (!args.length) { + msg.reply(atquotes.getQuote()); + } else if (args[0] == 'finn') { + msg.reply(atquotes.getFinnQuote()); + } else if (args[0] == 'jake') { + msg.reply(atquotes.getJakeQuote()); + } else if (args[0] == 'ice-king') { + msg.reply(atquotes.getIceKingQuote()); + } + } +} \ No newline at end of file diff --git a/commands/reboot.js b/commands/reboot.js new file mode 100644 index 0000000..b9fc6aa --- /dev/null +++ b/commands/reboot.js @@ -0,0 +1,10 @@ +module.exports = { + name: 'reboot', + aliases: ['r'], + description: '', + execute(msg, args, bot) { + msg.member.voiceChannel.join(); + msg.member.voiceChannel.leave(); + msg.reply('reboot finished lol'); + } +} \ No newline at end of file diff --git a/commands/say.js b/commands/say.js new file mode 100644 index 0000000..914a393 --- /dev/null +++ b/commands/say.js @@ -0,0 +1,11 @@ +module.exports = { + name: 'say', + description: '', + execute(msg, args, bot) { + if (msg.member.hasPermission('KICK_MEMBERS')) { + m = args.join(' '); + msg.channel.send(m); + msg.delete(); + } + } +} \ No newline at end of file diff --git a/commands/server.js b/commands/server.js new file mode 100644 index 0000000..417aa4c --- /dev/null +++ b/commands/server.js @@ -0,0 +1,26 @@ +const Discord = require('discord.js'); + +module.exports = { + name: 'server', + aliases: ['serverinfo'], + description: '', + execute(msg) { + var o = msg.guild.members.filter(m => m.presence.status === 'online').size; + + emb = new Discord.RichEmbed() + + .setAuthor(`${msg.guild.name} - ${msg.guild.id}`, `${msg.guild.iconURL}`, `https://discordapp.com/channels/${msg.guild.id}/${msg.guild.id}`) + .setDescription(`here\'s all the information on \`${msg.guild.name}\``) + .setThumbnail(`${msg.guild.iconURL}`) + .addField('owner', `${msg.guild.owner}`, false) + .addField(`members [${msg.guild.memberCount}]`, `${o} members are online.`, true) + .addField('region', `${msg.guild.region}`, true) + .addField('text channels', `${msg.guild.channels.filter(c => c.type === 'text').size}`, true) + .addField('voice channels', `${msg.guild.channels.filter(c => c.type === 'voice').size}`, true) + .addField('guild created', `${msg.guild.createdAt}`, false) + .addField('s5nical joined', `${msg.guild.members.get('695107550403756192').joinedAt}`) + .setColor(0xF97DAE); + + msg.channel.send(RichEmbed = emb); + } +} \ No newline at end of file diff --git a/commands/squeak.js b/commands/squeak.js new file mode 100644 index 0000000..02ef20a --- /dev/null +++ b/commands/squeak.js @@ -0,0 +1,20 @@ +module.exports = { + name: 'squeak', + description: '', + async execute(msg, args, bot) { + if (msg.member.voiceChannel && !msg.guild.voiceConnection) { + const connection = await msg.member.voiceChannel.join(); + const dispatcher = connection.playFile('./assets/audio/squeak.wav', { + volume: 0.2 + }); + + dispatcher.on('end', () => { + msg.member.voiceChannel.leave(); + }) + } else if (msg.guild.voiceConnection) { + msg.reply('i\'m already playing that lol'); + } else { + msg.reply('you need to join a voice channel first silly'); + } + } +} \ No newline at end of file diff --git a/commands/uhhhh.js b/commands/uhhhh.js new file mode 100644 index 0000000..18e6081 --- /dev/null +++ b/commands/uhhhh.js @@ -0,0 +1,20 @@ +module.exports = { + name: 'uhhhh', + description: '', + async execute(msg, args, bot) { + if (msg.member.voiceChannel && !msg.guild.voiceConnection) { + const connection = await msg.member.voiceChannel.join(); + const dispatcher = connection.playFile('./assets/audio/uhhhh.wav', { + volume: 0.5 + }); + + dispatcher.on('end', () => { + msg.member.voiceChannel.leave(); + }) + } else if (msg.guild.voiceConnection) { + msg.reply('i\'m already playing that lol'); + } else { + msg.reply('you need to join a voice channel first silly'); + } + } +} \ No newline at end of file diff --git a/commands/wahoo.js b/commands/wahoo.js new file mode 100644 index 0000000..540a801 --- /dev/null +++ b/commands/wahoo.js @@ -0,0 +1,20 @@ +module.exports = { + name: 'wahoo', + description: '', + async execute(msg, args, bot) { + if (msg.member.voiceChannel && !msg.guild.voiceConnection) { + const connection = await msg.member.voiceChannel.join(); + const dispatcher = connection.playFile('./assets/audio/wahoo.mp3', { + volume: 1.0 + }); + + dispatcher.on('end', () => { + msg.member.voiceChannel.leave(); + }) + } else if (msg.guild.voiceConnection) { + msg.reply('i\'m already playing that lol'); + } else { + msg.reply('you need to join a voice channel first silly'); + } + } +} \ No newline at end of file -- cgit v1.2.3 From 1885ab12c73c7a79a2e7d1a8055f9bd2b0a7f71b Mon Sep 17 00:00:00 2001 From: 8cy <50817549+8cy@users.noreply.github.com> Date: Tue, 7 Apr 2020 10:38:48 -0700 Subject: final test push before master --- app.js | 23 +- app_backup.js | 643 --------------------------------------- app_legacy.js | 358 ---------------------- app_temp.js | 143 +++++++++ assets/audio/mario_on_a_bike.mp3 | Bin 134575 -> 0 bytes assets/audio/mase_psycho.mp3 | Bin 3165759 -> 0 bytes commands/8ball.js | 2 +- commands/abee.js | 12 +- commands/botstatus.js | 15 + commands/clear.js | 2 +- commands/commands.js | 2 +- commands/dm.js | 8 +- commands/emoji.js | 2 +- commands/fart.js | 18 +- commands/help.js | 2 +- commands/join.js | 2 +- commands/leave.js | 2 +- commands/membercount.js | 2 +- commands/ping.js | 2 +- commands/psycho.js | 25 ++ commands/quote.js | 2 +- commands/reboot.js | 2 +- commands/say.js | 2 +- commands/server.js | 2 +- commands/squeak.js | 4 +- commands/uhhhh.js | 4 +- commands/wahoo.js | 4 +- 27 files changed, 232 insertions(+), 1051 deletions(-) delete mode 100644 app_backup.js delete mode 100644 app_legacy.js create mode 100644 app_temp.js delete mode 100644 assets/audio/mario_on_a_bike.mp3 delete mode 100644 assets/audio/mase_psycho.mp3 create mode 100644 commands/botstatus.js create mode 100644 commands/psycho.js diff --git a/app.js b/app.js index 69f98bf..c819d40 100644 --- a/app.js +++ b/app.js @@ -1,39 +1,32 @@ +// TODO: add pause, resume and volume + const fs = require('fs'); const Discord = require('discord.js'); const config = require('./config.json'); const bot = new Discord.Client(); bot.commands = new Discord.Collection(); const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js')); - for (const file of commandFiles) { const command = require(`./commands/${file}`); bot.commands.set(command.name, command); } - + bot.on('ready', () => { console.log(`Started bot: ${bot.user.tag} (ID: ${bot.user.id})\nCurrently running on ${bot.guilds.size} server(s).`); // Startup dialouge in output console bot.user.setActivity('psycho~ uwu', { // Set status type: 'LISTENING' }); - - // Outputs available commands in output console - //commands = ['bot', 'help']; - //console.log(commands); }); -// Outputs errors in console window bot.on('error', console.error); -// Start Bot Commands bot.on('message', async msg => { - //console.log(msg.content.toLowerCase()); //if (msg.channel.name === 'bots' || msg.channel.name === 'bot-commands' || msg.member.hasPermission('KICK_MEMBERS')) { var msgContent = msg.content.toLowerCase(); if (prefixCheck()) { console.log(msg.member.user.tag, 'says', msgContent, 'in #' + msg.channel.name); } - //console.log(config.prefixes.main); // Check prefixies in config.json function prefixCheck() { @@ -111,16 +104,18 @@ bot.on('message', async msg => { if (msg.member.hasPermission(p)) return true; } - // Begin commands - // if (command == 'ping') { - // bot.commands.get('ping').execute(bot, msg); - // } + // Main try { bot.commands.get(command).execute(msg, args, bot); return; } catch (error) { console.error(error); } + + // Reacts with ping emoji when @everyone + if (msg.mentions.everyone) { + msg.react(':ArisaPing:695887537390223402'); + } //} else if (msg.channel.name !== 'bots' && msg.content.startsWith(`${config.prefixes.main}`) && !msg.member.hasPermission('KICK_MEMBERS')) return; }); diff --git a/app_backup.js b/app_backup.js deleted file mode 100644 index e6e1ec8..0000000 --- a/app_backup.js +++ /dev/null @@ -1,643 +0,0 @@ -const fs = require('fs'); -const Discord = require('discord.js'); -const config = require('./config.json'); -const bot = new Discord.Client(); -bot.commands = new Discord.Collection(); -const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js')); -const isImageUrl = require('is-image-url'); -const emoji = require('emoji-random'); -const atquotes = require('at-quotes'); -const ytdl = require('ytdl-core'); - -for (const file of commandFiles) { - const command = require(`./commands/${file}`); - - // set a new item in the Collection - // with the key as the command name and the value as the exported module - bot.commands.set(command.name, command); -} - -bot.on('ready', () => { - console.log(`Started bot: ${bot.user.tag} (ID: ${bot.user.id})\nCurrently running on ${bot.guilds.size} server(s).`); // Startup dialouge in output console - bot.user.setActivity('psycho~ uwu', { // Set status - type: 'LISTENING' - }); - - // Outputs available commands in output console - //commands = ['bot', 'help']; - //console.log(commands); -}); - -// Outputs errors in console window -bot.on('error', console.error); - -// Start Bot Commands -bot.on('message', async msg => { - //console.log(msg.content.toLowerCase()); - if (msg.channel.name === 'bots' || msg.channel.name === 'bot-commands' || msg.member.hasPermission('KICK_MEMBERS')) { - // var msgContent = msg.content.toLowerCase(); - // if (prefixCheck()) { - // console.log(msg.member.user.tag, 'says', msgContent, 'in #' + msg.channel.name); - // } - //console.log(config.prefixes.main); - - // Check prefixies in config.json - function prefixCheck() { - if (msgContent.startsWith(config.prefixes.main)) { - return "main"; - } else if (msgContent.startsWith(config.prefixes.alt)) { - return "alt1"; - } else if (msgContent.startsWith(config.prefixes.alt2)) { - return "alt2"; - } else if (msgContent.startsWith(config.prefixes.alt3)) { - return "alt3"; - } else if (msgContent.startsWith(config.prefixes.alt4)) { - return "alt4"; - } else if (msgContent.startsWith(config.prefixes.alt5)) { - return "alt5"; - } else if (msgContent.startsWith(config.prefixes.alt6)) { - return "alt6"; - } else if (msgContent.startsWith(config.prefixes.alt6b)) { - return "alt6b"; - } - } - - if (prefixCheck() == "main") { - var args = msg.content.slice(config.prefixes.main.length).split(/ +/); - var command = args.shift().toLowerCase(); - - if (msg.author.bot || !msg.content.startsWith(config.prefixes.main)) return; - } else if (prefixCheck() == "alt1") { - var args = msg.content.slice(config.prefixes.alt.length).split(/ +/); - var command = args.shift().toLowerCase(); - - if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt)) return; - } else if (prefixCheck() == "alt2") { - var args = msg.content.slice(config.prefixes.alt2.length).split(/ +/); - var command = args.shift().toLocaleLowerCase(); - - if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt2)) return; - } else if (prefixCheck() == "alt3") { - var args = msg.content.slice(config.prefixes.alt3.length).split(/ +/); - var command = args.shift().toLocaleLowerCase(); - - if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt3)) return; - } else if (prefixCheck() == "alt4") { - var args = msg.content.slice(config.prefixes.alt4.length).split(/ +/); - var command = args.shift().toLocaleLowerCase(); - - if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4)) return; - } else if (prefixCheck() == "alt5") { - var args = msg.content.slice(config.prefixes.alt4.length).split(/ +/); - var command = args.shift().toLocaleLowerCase(); - - if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4)) return; - } else if (prefixCheck() == "alt6") { - var args = msg.content.slice(config.prefixes.alt4.length).split(/ +/); - var command = args.shift().toLocaleLowerCase(); - - if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4)) return; - } else if (prefixCheck() == "alt6b") { - var args = msg.content.slice(config.prefixes.alt4b.length).split(/ +/); - var command = args.shift().toLocaleLowerCase(); - - if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4b)) return; - } - - // Returns ping of bot - - function noArgs() { - msg.channel.send(`invalid argument(s). type \`${config.prefixes.main}help\` for more information.`); - } - - function noCommand() { - msg.channel.send(`invalid or unspecified command. type \`${config.prefixes.main}help\`.`); - } - - function perms(p) { - if (msg.member.hasPermission(p)) return true; - } - - // 8ball feature - if (command == '8ball' || command == 'ball' || command == '8b') { - r = ['yes~ uwu', 'no.', 'yes!', 'no!', 'what, no.', 'yes.', 'maybe.', 'perhaps.', 'try again.', 'i\'m not sure.']; - - var s = r[Math.floor(Math.random() * r.length)]; - - emb = new Discord.RichEmbed() - - .setAuthor('the 8-ball says', 'https://upload.wikimedia.org/wikipedia/commons/thumb/f/fd/8-Ball_Pool.svg/500px-8-Ball_Pool.svg.png') - .setDescription('`' + s + '`'); - - msg.channel.send(RichEmbed = emb); - } - - // Say feature, bot repeats what you say - if (command == 'say') { - if (msg.member.hasPermission('KICK_MEMBERS')) { - m = args.join(' '); - msg.channel.send(m); - msg.delete(); - } - } - - // Server info feature - if (command == 'server' || command == 'serverinfo') { - var o = msg.guild.members.filter(m => m.presence.status === 'online').size; - - emb = new Discord.RichEmbed() - - .setAuthor(`${msg.guild.name} - ${msg.guild.id}`, `${msg.guild.iconURL}`, `https://discordapp.com/channels/${msg.guild.id}/${msg.guild.id}`) - .setDescription(`here\'s all the information on \`${msg.guild.name}\``) - .setThumbnail(`${msg.guild.iconURL}`) - .addField('owner', `${msg.guild.owner}`, false) - .addField(`members [${msg.guild.memberCount}]`, `${o} members are online.`, true) - .addField('region', `${msg.guild.region}`, true) - .addField('text channels', `${msg.guild.channels.filter(c => c.type === 'text').size}`, true) - .addField('voice channels', `${msg.guild.channels.filter(c => c.type === 'voice').size}`, true) - .addField('guild created', `${msg.guild.createdAt}`, false) - .addField('s5nical joined', `${msg.guild.members.get('695107550403756192').joinedAt}`) - .setColor(0xF97DAE); - - msg.channel.send(RichEmbed = emb); - } - - if (command == 'leave') { - if (msg.guild.voiceConnection) { - msg.guild.voiceConnection.disconnect(); - msg.reply('succesfully left voice channel'); - } else { - msg.reply('i\'m not in a voice channel'); - } - } - - if (command == 'join') { - if (!msg.guild.voiceConnection && msg.member.voiceChannel) { - msg.member.voiceChannel.join(); - msg.reply('succesfully joined voice channel'); - } else if (msg.guild.voiceConnection) { - msg.reply('i\'m already in voice channel'); - } else if (!msg.member.voiceChannel) { - msg.reply('you\'re not in a voice channel'); - } - } - - if (command == 'reboot' | command == 'r') { - msg.member.voiceChannel.join(); - msg.member.voiceChannel.leave(); - msg.reply('reboot finished lol') - } - - /*if (command == 'pause') { - dispatcher.pause(); - } - - if (command == 'resume' || 'play') { - dispatcher.resume(); - } - - if (command == 'volume' || 'vol') { - - }*/ - - // Play mario on a bike - if (command == 'abee' || command == 'a-bee') { - if (msg.member.voiceChannel && !msg.guild.voiceConnection) { - const connection = await msg.member.voiceChannel.join(); - const dispatcher = connection.playFile('./assets/audio/mario_on_a_bike.mp3', { - volume: 0.5 - }); - - dispatcher.on('end', () => { - msg.member.voiceChannel.leave(); - }) - } else if (msg.guild.voiceConnection) { - msg.reply('i\'m already playing that lol') - } else { - msg.reply('you need to join a voice channel first silly'); - } - } - - // Play squeak on a bike - if (command == 'squeak') { - if (msg.member.voiceChannel && !msg.guild.voiceConnection) { - const connection = await msg.member.voiceChannel.join(); - const dispatcher = connection.playFile('./assets/audio/squeak.wav', { - volume: 0.2 - }); - - dispatcher.on('end', () => { - msg.member.voiceChannel.leave(); - }) - } else if (msg.guild.voiceConnection) { - msg.reply('i\'m already playing that lol') - } else { - msg.reply('you need to join a voice channel first silly'); - } - } - - // Play uhhhh - if (command == 'uhhhh') { - if (msg.member.voiceChannel && !msg.guild.voiceConnection) { - const connection = await msg.member.voiceChannel.join(); - const dispatcher = connection.playFile('./assets/audio/uhhhh.wav', { - volume: 0.5 - }); - - dispatcher.on('end', () => { - msg.member.voiceChannel.leave(); - }) - } else if (msg.guild.voiceConnection) { - msg.reply('i\'m already playing that lol') - } else { - msg.reply('you need to join a voice channel first silly'); - } - } - - // Plays Mase - Psycho - if (command == 'psycho') { - if (msg.member.voiceChannel && !msg.guild.voiceConnection) { - const connection = await msg.member.voiceChannel.join(); - const dispatcher = connection.playFile('./assets/audio/mase_psycho.mp3', { - volume: 0.5 - }); - - dispatcher.on('end', () => { - msg.member.voiceChannel.leave(); - }) - } else if (msg.guild.voiceConnection) { - msg.reply('i\'m already playing that lol') - } else { - msg.reply('you need to join a voice channel first silly'); - } - } - - if (command == 'fart') { - if (msg.member.voiceChannel && !msg.guild.voiceConnection) { - const connection = await msg.member.voiceChannel.join(); - var fartNum = Math.floor((Math.random() * 8) + 1); - - if (fartNum == 1) { - msg.reply('you got fart 1, courtesy of Sin') - const dispatcher = connection.playFile('./assets/audio/farts/1.mp3', { - volume: 0.5 - }); - dispatcher.on('end', () => { - msg.member.voiceChannel.leave(); - }) - } else if (fartNum == 2) { - msg.reply('you got fart 2, courtesy of Sin') - const dispatcher = connection.playFile('./assets/audio/farts/2.mp3', { - volume: 0.5 - }); - dispatcher.on('end', () => { - msg.member.voiceChannel.leave(); - }) - } else if (fartNum == 3) { - msg.reply('you got fart 3, courtesy of Sin') - const dispatcher = connection.playFile('./assets/audio/farts/3.mp3', { - volume: 0.5 - }); - dispatcher.on('end', () => { - msg.member.voiceChannel.leave(); - }) - } else if (fartNum == 4) { - msg.reply('you got fart 4, courtesy of Sin') - const dispatcher = connection.playFile('./assets/audio/farts/4.mp3', { - volume: 0.5 - }); - dispatcher.on('end', () => { - msg.member.voiceChannel.leave(); - }) - } else if (fartNum == 5) { - msg.reply('you got fart 5, courtesy of Sin') - const dispatcher = connection.playFile('./assets/audio/farts/5.mp3', { - volume: 0.5 - }); - dispatcher.on('end', () => { - msg.member.voiceChannel.leave(); - }) - } else if (fartNum == 6) { - msg.reply('you got fart 6, courtesy of nick') - const dispatcher = connection.playFile('./assets/audio/farts/6.mp3', { - volume: 0.5 - }); - dispatcher.on('end', () => { - msg.member.voiceChannel.leave(); - }) - } else if (fartNum == 7) { - msg.reply('you got fart 7, courtesy of nick') - const dispatcher = connection.playFile('./assets/audio/farts/7.mp3', { - volume: 0.5 - }); - dispatcher.on('end', () => { - msg.member.voiceChannel.leave(); - }) - } else if (fartNum == 8) { - msg.reply('you got fart 8, courtesy of nick') - const dispatcher = connection.playFile('./assets/audio/farts/8.mp3', { - volume: 0.5 - }); - dispatcher.on('end', () => { - msg.member.voiceChannel.leave(); - }) - } - } else if (msg.guild.voiceConnection) { - msg.reply('i\'m already playing that lol') - } else { - msg.reply('you need to join a voice channel first silly'); - } - } - - if (command == 'wahoo' | command == 'frozen' | command == 'frozenyyy') { - if (msg.member.voiceChannel && !msg.guild.voiceConnection) { - const connection = await msg.member.voiceChannel.join(); - const dispatcher = connection.playFile('./assets/audio/wahoo.mp3', { - volume: 1.0 - }); - - dispatcher.on('end', () => { - msg.member.voiceChannel.leave(); - }) - } else if (msg.guild.voiceConnection) { - msg.reply('i\'m already playing that lol') - } else { - msg.reply('you need to join a voice channel first silly'); - } - } - - if (command == 'yt-test') { - if (msg.member.voiceChannel && !msg.guild.voiceConnection) { - const connection = await msg.member.voiceChannel.join(); - const stream = ytdl('https://www.youtube.com/watch?v=3CS93CdMv_E', { filter: 'audioonly' }); - const dispatcher = connection.playStream(stream, { - volume: 0.5 - }); - - dispatcher.on('end', () => { - msg.member.voiceChannel.leave(); - }) - } else if (msg.guild.voiceConnection) { - msg.reply('i\'m already playing that lol') - } else { - msg.reply('you need to join a voice channel first silly'); - } - } - - // Help - if (command == 'help') { - if (!args.length) { - let emb = new Discord.RichEmbed() - - .setThumbnail(`${msg.guild.iconURL}`) - .setDescription(` - **command list**\nlink not yet set lol\n\n**categories list:**\n\`s5n!help \`\n\n**full list**\n\`s5n!commands\` - `) - .setColor(0xF97DAE); - - msg.channel.send(RichEmbed = emb); - } else if (args[0] == 'quotes' || args[0] == 'quote') { - let emb = new Discord.RichEmbed() - - .setTitle('quotes -> quote command: (server only)') - .setThumbnail(`${msg.guild.iconURL}`) - .setDescription(`says random quote from adventure time`) - .addField('details', `says random quote from adventure time -no argument: says a quote from any of the adventure time characters. -finn: says a quote from finn from adventure time. -jake: says a quote from jake from adventure time. -ice-king: says a quote from ice king from adventure time.`, false) - .addField(`format`, `\`s5n!quote [finn | jake | ice-king]\``, true) - .addField('examples', `\`s5n!quote\` - says a random quote any of the adventure time characters -\`s5n!quote finn\` - says a quote from finn from adventure time`, false) - .setFooter('<> - required, | - either/or, {} - optional') - .setColor(0xF97DAE); - - msg.channel.send(RichEmbed = emb); - } - } - - // Commands which you get directed to from help - if (command == 'commands') { - let emb = new Discord.RichEmbed() - - .setAuthor('s5nical\'s commands', `${msg.guild.iconURL}`) - .setThumbnail(`${msg.guild.iconURL}`) - .setDescription(`to view the commands in each group use:\n\`s5n!commands \``) - .addField(`:shield: moderation`, '13 commands.', true) - .addField(`:robot: automation`, '5 commands.', true) - .addField(`:gem: features`, '8 commands.', true) - .addField(`:lock: permissions`, '10 commands.', true) - .addField(`:mag_right: search`, '14 commands.', true) - .addField(`:wrench: utlity`, '20 commands.', true) - .addField(`:information_source: information`, '6 commands.', true) - .addField(`:smirk: fun`, '17 commands.', true) - .addField(`:moneybag: economy`, '8 commands.', true) - .addField(`:game_die: gambling`, '3 commands.', true) - .addField(`:smiley: profiles`, '4 commands.', true) - .addField(`:hammer_pick: skills`, '4 commands.', true) - .addField(`:frame_photo: image`, '3 commands.', true) - .addField(`:blue_heart: reaction`, '8 commands.', true) - .addField(`:chart_with_upwards_trend: counter`, '9 commands.', true) - .addField(`:sailboat: ship`, '2 commands.', true) - .setColor(0xF97DAE); - - msg.channel.send(RichEmbed = emb); - } - - // Member count - if (command == 'membercount' || command == 'memberc' || command == 'mcount' || command == 'mc') { - msg.reply(`there are **${msg.guild.memberCount}** members in **${msg.guild.name}**`); - } - - // Spits out random emoji - if (command == 'moji' || command == 'emoji') { - msg.reply(emoji.random()); - } - - // Spits out random quotes from Adventure TIme - if (command == 'quote' || command == 'quotes') { - if (!args.length) { - msg.reply(atquotes.getQuote()); - } else if (args[0] == 'finn') { - msg.reply(atquotes.getFinnQuote()); - } else if (args[0] == 'jake') { - msg.reply(atquotes.getJakeQuote()); - } else if (args[0] == 'ice-king') { - msg.reply(atquotes.getIceKingQuote()); - } - } - - // Clear/ delete messages in bulk command - if (command == 'clear' || command == 'delete' || command == 'del' || command == 'c') { - if (msg.member.hasPermission('MANAGE_MESSAGES')) { - if (!args) { - msg.reply('you haven\'t specified an amount of messages which should be deleted.').then(deleteNotificationMessage => { - deleteNotificationMessage.delete(1000); - }); - } else if (isNaN(args)) { - msg.reply('the amount parameter isn\'t a number.').then(deleteNotificationMessage => { - deleteNotificationMessage.delete(1000); - }); - } else if (args > 100) { - msg.reply('you can\'t delete more than 100 messages at once.').then(deleteNotificationMessage => { - deleteNotificationMessage.delete(1000); - }); - } else if (args < 1) { - msg.reply('you have to delete at least 1 message.').then(deleteNotificationMessage => { - deleteNotificationMessage.delete(1000); - }); - } /*else if (msg.createdTimestamp > 1209600) { - msg.reply('due to discord rules, bots can only bulk delete messages that are under 14 days old :(') - } */ - else { - var clearAmount = parseInt(args[0]) + 1 - // It took me so long to figure out why this was not really working. It would delete but an insane amount at a time. - // I realized that because it was getting parsed as a string, it would just add 1 to it so if I tried to delete 1 - // message, it would delete 11 lol. Fixed by parsing as integer THEN adding one. 02:30 2020/04/03/2020 - - await msg.channel.fetchMessages({ limit: clearAmount }).then(messages => { // I am on v11 discord.js - msg.channel.bulkDelete(messages); - }); - msg.reply('it\'s been deleted ~uwu').then(deleteNotificationMessage => { - deleteNotificationMessage.delete(1000); - }); - } - } else { - msg.reply('insufficent perms bruh'); - } - } - - if (command == 'dm') { - if (msg.author) { // TODO: fix discord not evaluating args[1] - if (!msg.mentions.users.first() && !args[1]) { - msg.reply('you haven\'t specified a user or a message.') - } else if (!args[1]) { - msg.reply('you haven\'t specified anything to send.') - } else if (!msg.mentions.users.first()) { - msg.reply('you haven\'t specified anyone to send a dm to.') - } else { - var sendTo = msg.mentions.users.first().id; - var d = new Date(msg.createdTimestamp); - - msg.guild.fetchMember(sendTo, false).then(messageUser => { - messageUser.send(args[0]) - - let emb = new Discord.RichEmbed() - - //.setDescription(`to view the commands in each group use:\n\`s5n!commands \``) - .addField(`message`, args[1], true) - .addField(`recipient`, args[0], true) - .addField(`time sent`, d) - .setColor(0xF97DAE); - - msg.channel.send(RichEmbed = emb); - }) - } - - // This shit took about an hour and a half to debug because I couldn't figure out how to convert the first arguement into - // a user id. After getting help from discord.js Discord I fixed it for about 30 seconds at 21:26 and then I broke it again instantlly - // after. Then I tried to fix everything and I almost broke everything again but I realized it was broken because I did s5n!dm instead - // of s5n!test and I hadn't ported the code over from test to. 2020/04/02, 21:34 - //where sendTo and d went - //args[0] = args[0].id - //msg.reply(args[0]); - // args[0]; - - // msg.reply(typeof args[0]) // for debugging - - // const collector = new Discord.MessageCollector(msg.channel, m => m.author.id === msg.author.id, { - // time: 5000 - // }); - // msg.reply('timed out', 5000) - // //console.log(collector) - - // collector.on('collect', message => { - // var messageText = message.content; - - // if (msg.member.message) { - // msg.reply('received') - // } - // }) - - // msg.reply('what would you like to say?'); - // if (msg.member.lastMessage) { - // var messageText = msg.member.lastMessage.content; - // } - - // where send function went - } else { - msg.reply('insufficent perms bruh'); - } - } - - if (msg.mentions.everyone) { - msg.react(':ArisaPing:695887537390223402'); - } - - /*if (command == 'botstatus' || command == 'status' || command == 'bs') { - if (msg.member.hasPermission('KICK_MEMBERS')) { - if (!args) { - msg.reply('no status specified') - } - - if (args == 'online') { - bot.user.setStatus("online"); - } else if (args == 'idle') { - bot.user.setStatus("idle"); - } else if (args == 'dnd') { - bot.user.setStatus("dnd"); - } else if (args == 'invisable') { - bot.user.setStatus("invisable"); - } - } else { - msg.reply('insufficent perms bruh'); - } - }*/ - - // Change status and status message - /*if (command == 'botstatus' || command == 'status' || command == 'bs') { - if (msg.member.hasPermission('KICK_MEMBERS')) { - if (!args[0] && !args[1]) { - msg.reply('you haven\'t specified a status or a message.') - } else if (!args[1]) { - msg.reply('you haven\'t specified a message.') - } else if (!args[0]) { - msg.reply('you haven\'t specified a status.') - } else { - status = args[0].toLocaleUpperCase(); - var d = new Date(msg.createdTimestamp); - - bot.user.setActivity(args[1], { - type: status - }); - - let emb = new Discord.RichEmbed() - - //.setDescription(`to view the commands in each group use:\n\`s5n!commands \``) - .addField(`status message`, args[1], true) - .addField(`status`, status, true) - .addField(`time changed`, d) - .setColor(0xF97DAE); - - msg.channel.send(RichEmbed = emb); - } - } - }*/ - - /*function joinCheck() { - switch (msg.guild.voiceConnection) { - case !msg.guild.voiceConnection && msg.member.voiceChannel: - msg.member.voiceChannel.join(); - msg.reply('succesfully joined voice channel') - case (msg.guild.voiceConnection): - msg.reply('i\'m already in voice channel') - case (!msg.member.voiceChannel): - msg.reply('you\'re not in a voice channel') - } - }*/ - } else if (msg.channel.name !== 'bots' && msg.content.startsWith(`${config.prefixes.main}`) && !msg.member.hasPermission('KICK_MEMBERS')) return; -}) - -// Get bot token -bot.login(config['secret']) \ No newline at end of file diff --git a/app_legacy.js b/app_legacy.js deleted file mode 100644 index 2cf52dd..0000000 --- a/app_legacy.js +++ /dev/null @@ -1,358 +0,0 @@ -const Discord = require('discord.js'); -const config = require('./config.json'); -const bot = new Discord.Client(); -const isImageUrl = require('is-image-url'); -const emoji = require('emoji-random'); -const atquotes = require('at-quotes'); -const ytdl = require('ytdl-core'); - -bot.on('ready', () => { - console.log(`Started bot: ${bot.user.tag} (ID: ${bot.user.id})\nCurrently running on ${bot.guilds.size} server(s).`); // Startup dialouge in output console - bot.user.setActivity('psycho~ uwu', { // Set status - type: 'LISTENING' - }); - - // Outputs available commands in output console - //commands = ['bot', 'help']; - //console.log(commands); -}); - -// Outputs errors in console window -bot.on('error', console.error); - -// Start Bot Commands -bot.on('message', async msg => { - //console.log(msg.content.toLowerCase()); - if (msg.channel.name === 'bots' || msg.channel.name === 'bot-commands' || msg.member.hasPermission('KICK_MEMBERS')) { - var msgContent = msg.content.toLowerCase(); - if (prefixCheck()) { - console.log(msg.member.user.tag, 'says', msgContent, 'in #' + msg.channel.name); - } - //console.log(config.prefixes.main); - - // Check prefixies in config.json - function prefixCheck() { - if (msgContent.startsWith(config.prefixes.main)) { - return "main"; - } else if (msgContent.startsWith(config.prefixes.alt)) { - return "alt1"; - } else if (msgContent.startsWith(config.prefixes.alt2)) { - return "alt2"; - } else if (msgContent.startsWith(config.prefixes.alt3)) { - return "alt3"; - } else if (msgContent.startsWith(config.prefixes.alt4)) { - return "alt4"; - } else if (msgContent.startsWith(config.prefixes.alt5)) { - return "alt5"; - } else if (msgContent.startsWith(config.prefixes.alt6)) { - return "alt6"; - } else if (msgContent.startsWith(config.prefixes.alt6b)) { - return "alt6b"; - } - } - - if (prefixCheck() == "main") { - var args = msg.content.slice(config.prefixes.main.length).split(/ +/); - var command = args.shift().toLowerCase(); - - if (msg.author.bot || !msg.content.startsWith(config.prefixes.main)) return; - } else if (prefixCheck() == "alt1") { - var args = msg.content.slice(config.prefixes.alt.length).split(/ +/); - var command = args.shift().toLowerCase(); - - if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt)) return; - } else if (prefixCheck() == "alt2") { - var args = msg.content.slice(config.prefixes.alt2.length).split(/ +/); - var command = args.shift().toLocaleLowerCase(); - - if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt2)) return; - } else if (prefixCheck() == "alt3") { - var args = msg.content.slice(config.prefixes.alt3.length).split(/ +/); - var command = args.shift().toLocaleLowerCase(); - - if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt3)) return; - } else if (prefixCheck() == "alt4") { - var args = msg.content.slice(config.prefixes.alt4.length).split(/ +/); - var command = args.shift().toLocaleLowerCase(); - - if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4)) return; - } else if (prefixCheck() == "alt5") { - var args = msg.content.slice(config.prefixes.alt4.length).split(/ +/); - var command = args.shift().toLocaleLowerCase(); - - if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4)) return; - } else if (prefixCheck() == "alt6") { - var args = msg.content.slice(config.prefixes.alt4.length).split(/ +/); - var command = args.shift().toLocaleLowerCase(); - - if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4)) return; - } else if (prefixCheck() == "alt6b") { - var args = msg.content.slice(config.prefixes.alt4b.length).split(/ +/); - var command = args.shift().toLocaleLowerCase(); - - if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4b)) return; - } - - // Returns ping of bot - if (command == 'ping' || command == 'ms') { - const t = Date.now(); - - msg.channel.send('plz wait..').then(m => { - m.edit(`** **`); - - const n = Date.now(); - let emb = new Discord.RichEmbed() - - .setDescription(`pong! s5nical's is \`${n - t}ms\`. heartbeat \`${bot.ping}ms\`.`) - .setColor(0xF97DAE); - - msg.channel.send(RichEmbed = emb); - }); - } - - function noArgs() { - msg.channel.send(`invalid argument(s). type \`${config.prefixes.main}help\` for more information.`); - } - - function noCommand() { - msg.channel.send(`invalid or unspecified command. type \`${config.prefixes.main}help\`.`); - } - - function perms(p) { - if (msg.member.hasPermission(p)) return true; - } - - /*if (command == 'pause') { - dispatcher.pause(); - } - - if (command == 'resume' || 'play') { - dispatcher.resume(); - } - - if (command == 'volume' || 'vol') { - - }*/ - - // Plays Mase - Psycho - if (command == 'psycho') { - if (msg.member.voiceChannel && !msg.guild.voiceConnection) { - const connection = await msg.member.voiceChannel.join(); - const dispatcher = connection.playFile('./assets/audio/mase_psycho.mp3', { - volume: 0.5 - }); - - dispatcher.on('end', () => { - msg.member.voiceChannel.leave(); - }) - } else if (msg.guild.voiceConnection) { - msg.reply('i\'m already playing that lol') - } else { - msg.reply('you need to join a voice channel first silly'); - } - } - - if (command == 'yt-test') { - if (msg.member.voiceChannel && !msg.guild.voiceConnection) { - const connection = await msg.member.voiceChannel.join(); - const stream = ytdl('https://www.youtube.com/watch?v=3CS93CdMv_E', { filter: 'audioonly' }); - const dispatcher = connection.playStream(stream, { - volume: 0.5 - }); - - dispatcher.on('end', () => { - msg.member.voiceChannel.leave(); - }) - } else if (msg.guild.voiceConnection) { - msg.reply('i\'m already playing that lol') - } else { - msg.reply('you need to join a voice channel first silly'); - } - } - - // Spits out random quotes from Adventure TIme - if (command == 'quote' || command == 'quotes') { - if (!args.length) { - msg.reply(atquotes.getQuote()); - } else if (args[0] == 'finn') { - msg.reply(atquotes.getFinnQuote()); - } else if (args[0] == 'jake') { - msg.reply(atquotes.getJakeQuote()); - } else if (args[0] == 'ice-king') { - msg.reply(atquotes.getIceKingQuote()); - } - } - - // Clear/ delete messages in bulk command - if (command == 'clear' || command == 'delete' || command == 'del' || command == 'c') { - if (msg.member.hasPermission('MANAGE_MESSAGES')) { - if (!args) { - msg.reply('you haven\'t specified an amount of messages which should be deleted.').then(deleteNotificationMessage => { - deleteNotificationMessage.delete(1000); - }); - } else if (isNaN(args)) { - msg.reply('the amount parameter isn\'t a number.').then(deleteNotificationMessage => { - deleteNotificationMessage.delete(1000); - }); - } else if (args > 100) { - msg.reply('you can\'t delete more than 100 messages at once.').then(deleteNotificationMessage => { - deleteNotificationMessage.delete(1000); - }); - } else if (args < 1) { - msg.reply('you have to delete at least 1 message.').then(deleteNotificationMessage => { - deleteNotificationMessage.delete(1000); - }); - } /*else if (msg.createdTimestamp > 1209600) { - msg.reply('due to discord rules, bots can only bulk delete messages that are under 14 days old :(') - } */ - else { - var clearAmount = parseInt(args[0]) + 1 - // It took me so long to figure out why this was not really working. It would delete but an insane amount at a time. - // I realized that because it was getting parsed as a string, it would just add 1 to it so if I tried to delete 1 - // message, it would delete 11 lol. Fixed by parsing as integer THEN adding one. 02:30 2020/04/03/2020 - - await msg.channel.fetchMessages({ limit: clearAmount }).then(messages => { // I am on v11 discord.js - msg.channel.bulkDelete(messages); - }); - msg.reply('it\'s been deleted ~uwu').then(deleteNotificationMessage => { - deleteNotificationMessage.delete(1000); - }); - } - } else { - msg.reply('insufficent perms bruh'); - } - } - - if (command == 'dm') { - if (msg.author) { // TODO: fix discord not evaluating args[1] - if (!msg.mentions.users.first() && !args[1]) { - msg.reply('you haven\'t specified a user or a message.') - } else if (!args[1]) { - msg.reply('you haven\'t specified anything to send.') - } else if (!msg.mentions.users.first()) { - msg.reply('you haven\'t specified anyone to send a dm to.') - } else { - var sendTo = msg.mentions.users.first().id; - var d = new Date(msg.createdTimestamp); - - msg.guild.fetchMember(sendTo, false).then(messageUser => { - messageUser.send(args[0]) - - let emb = new Discord.RichEmbed() - - //.setDescription(`to view the commands in each group use:\n\`s5n!commands \``) - .addField(`message`, args[1], true) - .addField(`recipient`, args[0], true) - .addField(`time sent`, d) - .setColor(0xF97DAE); - - msg.channel.send(RichEmbed = emb); - }) - } - - // This shit took about an hour and a half to debug because I couldn't figure out how to convert the first arguement into - // a user id. After getting help from discord.js Discord I fixed it for about 30 seconds at 21:26 and then I broke it again instantlly - // after. Then I tried to fix everything and I almost broke everything again but I realized it was broken because I did s5n!dm instead - // of s5n!test and I hadn't ported the code over from test to. 2020/04/02, 21:34 - //where sendTo and d went - //args[0] = args[0].id - //msg.reply(args[0]); - // args[0]; - - // msg.reply(typeof args[0]) // for debugging - - // const collector = new Discord.MessageCollector(msg.channel, m => m.author.id === msg.author.id, { - // time: 5000 - // }); - // msg.reply('timed out', 5000) - // //console.log(collector) - - // collector.on('collect', message => { - // var messageText = message.content; - - // if (msg.member.message) { - // msg.reply('received') - // } - // }) - - // msg.reply('what would you like to say?'); - // if (msg.member.lastMessage) { - // var messageText = msg.member.lastMessage.content; - // } - - // where send function went - } else { - msg.reply('insufficent perms bruh'); - } - } - - if (msg.mentions.everyone) { - msg.react(':ArisaPing:695887537390223402'); - } - - /*if (command == 'botstatus' || command == 'status' || command == 'bs') { - if (msg.member.hasPermission('KICK_MEMBERS')) { - if (!args) { - msg.reply('no status specified') - } - - if (args == 'online') { - bot.user.setStatus("online"); - } else if (args == 'idle') { - bot.user.setStatus("idle"); - } else if (args == 'dnd') { - bot.user.setStatus("dnd"); - } else if (args == 'invisable') { - bot.user.setStatus("invisable"); - } - } else { - msg.reply('insufficent perms bruh'); - } - }*/ - - // Change status and status message - /*if (command == 'botstatus' || command == 'status' || command == 'bs') { - if (msg.member.hasPermission('KICK_MEMBERS')) { - if (!args[0] && !args[1]) { - msg.reply('you haven\'t specified a status or a message.') - } else if (!args[1]) { - msg.reply('you haven\'t specified a message.') - } else if (!args[0]) { - msg.reply('you haven\'t specified a status.') - } else { - status = args[0].toLocaleUpperCase(); - var d = new Date(msg.createdTimestamp); - - bot.user.setActivity(args[1], { - type: status - }); - - let emb = new Discord.RichEmbed() - - //.setDescription(`to view the commands in each group use:\n\`s5n!commands \``) - .addField(`status message`, args[1], true) - .addField(`status`, status, true) - .addField(`time changed`, d) - .setColor(0xF97DAE); - - msg.channel.send(RichEmbed = emb); - } - } - }*/ - - /*function joinCheck() { - switch (msg.guild.voiceConnection) { - case !msg.guild.voiceConnection && msg.member.voiceChannel: - msg.member.voiceChannel.join(); - msg.reply('succesfully joined voice channel') - case (msg.guild.voiceConnection): - msg.reply('i\'m already in voice channel') - case (!msg.member.voiceChannel): - msg.reply('you\'re not in a voice channel') - } - }*/ - } else if (msg.channel.name !== 'bots' && msg.content.startsWith(`${config.prefixes.main}`) && !msg.member.hasPermission('KICK_MEMBERS')) return; -}) - -// Get bot token -bot.login(config['secret']) \ No newline at end of file diff --git a/app_temp.js b/app_temp.js new file mode 100644 index 0000000..abbb40a --- /dev/null +++ b/app_temp.js @@ -0,0 +1,143 @@ +const Discord = require('discord.js'); +const config = require('./config.json'); +const bot = new Discord.Client(); +const isImageUrl = require('is-image-url'); +const emoji = require('emoji-random'); +const atquotes = require('at-quotes'); +const ytdl = require('ytdl-core'); + +bot.on('ready', () => { + console.log(`Started bot: ${bot.user.tag} (ID: ${bot.user.id})\nCurrently running on ${bot.guilds.size} server(s).`); // Startup dialouge in output console + bot.user.setActivity('psycho~ uwu', { // Set status + type: 'LISTENING' + }); + + // Outputs available commands in output console + //commands = ['bot', 'help']; + //console.log(commands); +}); + +// Outputs errors in console window +bot.on('error', console.error); + +// Start Bot Commands +bot.on('message', async msg => { + //console.log(msg.content.toLowerCase()); + if (msg.channel.name === 'bots' || msg.channel.name === 'bot-commands' || msg.member.hasPermission('KICK_MEMBERS')) { + var msgContent = msg.content.toLowerCase(); + if (prefixCheck()) { + console.log(msg.member.user.tag, 'says', msgContent, 'in #' + msg.channel.name); + } + //console.log(config.prefixes.main); + + // Check prefixies in config.json + function prefixCheck() { + if (msgContent.startsWith(config.prefixes.main)) { + return "main"; + } else if (msgContent.startsWith(config.prefixes.alt)) { + return "alt1"; + } else if (msgContent.startsWith(config.prefixes.alt2)) { + return "alt2"; + } else if (msgContent.startsWith(config.prefixes.alt3)) { + return "alt3"; + } else if (msgContent.startsWith(config.prefixes.alt4)) { + return "alt4"; + } else if (msgContent.startsWith(config.prefixes.alt5)) { + return "alt5"; + } else if (msgContent.startsWith(config.prefixes.alt6)) { + return "alt6"; + } else if (msgContent.startsWith(config.prefixes.alt6b)) { + return "alt6b"; + } + } + + if (prefixCheck() == "main") { + var args = msg.content.slice(config.prefixes.main.length).split(/ +/); + var command = args.shift().toLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.main)) return; + } else if (prefixCheck() == "alt1") { + var args = msg.content.slice(config.prefixes.alt.length).split(/ +/); + var command = args.shift().toLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt)) return; + } else if (prefixCheck() == "alt2") { + var args = msg.content.slice(config.prefixes.alt2.length).split(/ +/); + var command = args.shift().toLocaleLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt2)) return; + } else if (prefixCheck() == "alt3") { + var args = msg.content.slice(config.prefixes.alt3.length).split(/ +/); + var command = args.shift().toLocaleLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt3)) return; + } else if (prefixCheck() == "alt4") { + var args = msg.content.slice(config.prefixes.alt4.length).split(/ +/); + var command = args.shift().toLocaleLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4)) return; + } else if (prefixCheck() == "alt5") { + var args = msg.content.slice(config.prefixes.alt4.length).split(/ +/); + var command = args.shift().toLocaleLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4)) return; + } else if (prefixCheck() == "alt6") { + var args = msg.content.slice(config.prefixes.alt4.length).split(/ +/); + var command = args.shift().toLocaleLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4)) return; + } else if (prefixCheck() == "alt6b") { + var args = msg.content.slice(config.prefixes.alt4b.length).split(/ +/); + var command = args.shift().toLocaleLowerCase(); + + if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4b)) return; + } + + function noArgs() { + msg.channel.send(`invalid argument(s). type \`${config.prefixes.main}help\` for more information.`); + } + + function noCommand() { + msg.channel.send(`invalid or unspecified command. type \`${config.prefixes.main}help\`.`); + } + + function perms(p) { + if (msg.member.hasPermission(p)) return true; + } + + /*if (command == 'botstatus' || command == 'status' || command == 'bs') { + if (msg.member.hasPermission('KICK_MEMBERS')) { + if (!args) { + msg.reply('no status specified') + } + + if (args == 'online') { + bot.user.setStatus("online"); + } else if (args == 'idle') { + bot.user.setStatus("idle"); + } else if (args == 'dnd') { + bot.user.setStatus("dnd"); + } else if (args == 'invisable') { + bot.user.setStatus("invisable"); + } + } else { + msg.reply('insufficent perms bruh'); + } + }*/ + + /*function joinCheck() { + switch (msg.guild.voiceConnection) { + case !msg.guild.voiceConnection && msg.member.voiceChannel: + msg.member.voiceChannel.join(); + msg.reply('succesfully joined voice channel') + case (msg.guild.voiceConnection): + msg.reply('i\'m already in voice channel') + case (!msg.member.voiceChannel): + msg.reply('you\'re not in a voice channel') + } + }*/ + } else if (msg.channel.name !== 'bots' && msg.content.startsWith(`${config.prefixes.main}`) && !msg.member.hasPermission('KICK_MEMBERS')) return; +}) + +// Get bot token +bot.login(config['secret']) \ No newline at end of file diff --git a/assets/audio/mario_on_a_bike.mp3 b/assets/audio/mario_on_a_bike.mp3 deleted file mode 100644 index 7144866..0000000 Binary files a/assets/audio/mario_on_a_bike.mp3 and /dev/null differ diff --git a/assets/audio/mase_psycho.mp3 b/assets/audio/mase_psycho.mp3 deleted file mode 100644 index 1b6357c..0000000 Binary files a/assets/audio/mase_psycho.mp3 and /dev/null differ diff --git a/commands/8ball.js b/commands/8ball.js index e8e3e4a..e865176 100644 --- a/commands/8ball.js +++ b/commands/8ball.js @@ -16,4 +16,4 @@ module.exports = { msg.channel.send(RichEmbed = emb); } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/commands/abee.js b/commands/abee.js index c665b12..f46a06b 100644 --- a/commands/abee.js +++ b/commands/abee.js @@ -1,11 +1,15 @@ +const ytdl = require('ytdl-core'); + module.exports = { name: 'abee', - aliases: ['a-bee'], description: '', - async execute(msg) { + async execute(msg, args, bot) { if (msg.member.voiceChannel && !msg.guild.voiceConnection) { const connection = await msg.member.voiceChannel.join(); - const dispatcher = connection.playFile('./assets/audio/mario_on_a_bike.mp3', { + const stream = ytdl('https://www.youtube.com/watch?v=lvdnhWhQBdo', { + filter: 'audioonly' + }); + const dispatcher = connection.playStream(stream, { volume: 0.5 }); @@ -18,4 +22,4 @@ module.exports = { msg.reply('you need to join a voice channel first silly'); } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/commands/botstatus.js b/commands/botstatus.js new file mode 100644 index 0000000..6401571 --- /dev/null +++ b/commands/botstatus.js @@ -0,0 +1,15 @@ +// TODO: bot status + +module.exports = { + name: 'botstatus', + aliases: ['status', 'bs'], + description: '', + async execute(msg, args, bot) { + if (msg.member.hasPermission('KICK_MEMBERS')) { + m = args.join(' '); + bot.user.setActivity(m); + } else { + msg.reply('insufficent perms bruh'); + } + } +}; \ No newline at end of file diff --git a/commands/clear.js b/commands/clear.js index 90eef2e..fe8e46f 100644 --- a/commands/clear.js +++ b/commands/clear.js @@ -43,4 +43,4 @@ module.exports = { msg.reply('insufficent perms bruh'); } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/commands/commands.js b/commands/commands.js index e78ae45..47af2e6 100644 --- a/commands/commands.js +++ b/commands/commands.js @@ -29,4 +29,4 @@ module.exports = { msg.channel.send(RichEmbed = emb); } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/commands/dm.js b/commands/dm.js index edd8a0a..fcaeb0d 100644 --- a/commands/dm.js +++ b/commands/dm.js @@ -4,11 +4,11 @@ module.exports = { execute(msg, args, bot) { if (msg.author) { // TODO: fix discord not evaluating args[1] if (!msg.mentions.users.first() && !args[1]) { - msg.reply('you haven\'t specified a user or a message.') + msg.reply('you haven\'t specified a user or a message.'); } else if (!args[1]) { - msg.reply('you haven\'t specified anything to send.') + msg.reply('you haven\'t specified anything to send.'); } else if (!msg.mentions.users.first()) { - msg.reply('you haven\'t specified anyone to send a dm to.') + msg.reply('you haven\'t specified anyone to send a dm to.'); } else { var sendTo = msg.mentions.users.first().id; var d = new Date(msg.createdTimestamp); @@ -63,4 +63,4 @@ module.exports = { msg.reply('insufficent perms bruh'); } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/commands/emoji.js b/commands/emoji.js index 28ab679..5724895 100644 --- a/commands/emoji.js +++ b/commands/emoji.js @@ -7,4 +7,4 @@ module.exports = { execute(msg, args, bot) { msg.reply(emoji.random()); } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/commands/fart.js b/commands/fart.js index 3da3f3b..de62889 100644 --- a/commands/fart.js +++ b/commands/fart.js @@ -13,7 +13,7 @@ module.exports = { }); dispatcher.on('end', () => { msg.member.voiceChannel.leave(); - }) + }); } else if (fartNum == 2) { msg.reply('you got fart 2, courtesy of Sin'); const dispatcher = connection.playFile('./assets/audio/farts/2.mp3', { @@ -21,7 +21,7 @@ module.exports = { }); dispatcher.on('end', () => { msg.member.voiceChannel.leave(); - }) + }); } else if (fartNum == 3) { msg.reply('you got fart 3, courtesy of Sin'); const dispatcher = connection.playFile('./assets/audio/farts/3.mp3', { @@ -29,7 +29,7 @@ module.exports = { }); dispatcher.on('end', () => { msg.member.voiceChannel.leave(); - }) + }); } else if (fartNum == 4) { msg.reply('you got fart 4, courtesy of Sin'); const dispatcher = connection.playFile('./assets/audio/farts/4.mp3', { @@ -37,7 +37,7 @@ module.exports = { }); dispatcher.on('end', () => { msg.member.voiceChannel.leave(); - }) + }); } else if (fartNum == 5) { msg.reply('you got fart 5, courtesy of Sin'); const dispatcher = connection.playFile('./assets/audio/farts/5.mp3', { @@ -45,7 +45,7 @@ module.exports = { }); dispatcher.on('end', () => { msg.member.voiceChannel.leave(); - }) + }); } else if (fartNum == 6) { msg.reply('you got fart 6, courtesy of nick'); const dispatcher = connection.playFile('./assets/audio/farts/6.mp3', { @@ -53,7 +53,7 @@ module.exports = { }); dispatcher.on('end', () => { msg.member.voiceChannel.leave(); - }) + }); } else if (fartNum == 7) { msg.reply('you got fart 7, courtesy of nick'); const dispatcher = connection.playFile('./assets/audio/farts/7.mp3', { @@ -61,7 +61,7 @@ module.exports = { }); dispatcher.on('end', () => { msg.member.voiceChannel.leave(); - }) + }); } else if (fartNum == 8) { msg.reply('you got fart 8, courtesy of nick'); const dispatcher = connection.playFile('./assets/audio/farts/8.mp3', { @@ -69,7 +69,7 @@ module.exports = { }); dispatcher.on('end', () => { msg.member.voiceChannel.leave(); - }) + }); } } else if (msg.guild.voiceConnection) { msg.reply('i\'m already playing that lol'); @@ -77,4 +77,4 @@ module.exports = { msg.reply('you need to join a voice channel first silly'); } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/commands/help.js b/commands/help.js index 4c7ecf0..b963301 100644 --- a/commands/help.js +++ b/commands/help.js @@ -34,4 +34,4 @@ ice-king: says a quote from ice king from adventure time.`, false) msg.channel.send(RichEmbed = emb); } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/commands/join.js b/commands/join.js index 15ef1de..b07e6c7 100644 --- a/commands/join.js +++ b/commands/join.js @@ -12,4 +12,4 @@ module.exports = { msg.reply('you\'re not in a voice channel'); } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/commands/leave.js b/commands/leave.js index 51fac82..6965069 100644 --- a/commands/leave.js +++ b/commands/leave.js @@ -9,4 +9,4 @@ module.exports = { msg.reply('i\'m not in a voice channel'); } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/commands/membercount.js b/commands/membercount.js index 7c32f16..8edc030 100644 --- a/commands/membercount.js +++ b/commands/membercount.js @@ -5,4 +5,4 @@ module.exports = { execute(msg, args, bot) { msg.reply(`there are **${msg.guild.memberCount}** members in **${msg.guild.name}**`); } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/commands/ping.js b/commands/ping.js index b881170..7837180 100644 --- a/commands/ping.js +++ b/commands/ping.js @@ -18,4 +18,4 @@ module.exports = { msg.channel.send(RichEmbed = emb); }); } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/commands/psycho.js b/commands/psycho.js new file mode 100644 index 0000000..9ecc8a1 --- /dev/null +++ b/commands/psycho.js @@ -0,0 +1,25 @@ +const ytdl = require('ytdl-core'); + +module.exports = { + name: 'psycho', + description: '', + async execute(msg, args, bot) { + if (msg.member.voiceChannel && !msg.guild.voiceConnection) { + const connection = await msg.member.voiceChannel.join(); + const stream = ytdl('https://www.youtube.com/watch?v=fnd_HSmAODs', { + filter: 'audioonly' + }); + const dispatcher = connection.playStream(stream, { + volume: 0.5 + }); + + dispatcher.on('end', () => { + msg.member.voiceChannel.leave(); + }); + } else if (msg.guild.voiceConnection) { + msg.reply('i\'m already playing that lol'); + } else { + msg.reply('you need to join a voice channel first silly'); + } + } +}; \ No newline at end of file diff --git a/commands/quote.js b/commands/quote.js index 8b182e6..133c9eb 100644 --- a/commands/quote.js +++ b/commands/quote.js @@ -15,4 +15,4 @@ module.exports = { msg.reply(atquotes.getIceKingQuote()); } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/commands/reboot.js b/commands/reboot.js index b9fc6aa..f5ec9eb 100644 --- a/commands/reboot.js +++ b/commands/reboot.js @@ -7,4 +7,4 @@ module.exports = { msg.member.voiceChannel.leave(); msg.reply('reboot finished lol'); } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/commands/say.js b/commands/say.js index 914a393..a27558f 100644 --- a/commands/say.js +++ b/commands/say.js @@ -8,4 +8,4 @@ module.exports = { msg.delete(); } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/commands/server.js b/commands/server.js index 417aa4c..220857d 100644 --- a/commands/server.js +++ b/commands/server.js @@ -23,4 +23,4 @@ module.exports = { msg.channel.send(RichEmbed = emb); } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/commands/squeak.js b/commands/squeak.js index 02ef20a..a1c4046 100644 --- a/commands/squeak.js +++ b/commands/squeak.js @@ -10,11 +10,11 @@ module.exports = { dispatcher.on('end', () => { msg.member.voiceChannel.leave(); - }) + }); } else if (msg.guild.voiceConnection) { msg.reply('i\'m already playing that lol'); } else { msg.reply('you need to join a voice channel first silly'); } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/commands/uhhhh.js b/commands/uhhhh.js index 18e6081..3c84d8d 100644 --- a/commands/uhhhh.js +++ b/commands/uhhhh.js @@ -10,11 +10,11 @@ module.exports = { dispatcher.on('end', () => { msg.member.voiceChannel.leave(); - }) + }); } else if (msg.guild.voiceConnection) { msg.reply('i\'m already playing that lol'); } else { msg.reply('you need to join a voice channel first silly'); } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/commands/wahoo.js b/commands/wahoo.js index 540a801..4745874 100644 --- a/commands/wahoo.js +++ b/commands/wahoo.js @@ -10,11 +10,11 @@ module.exports = { dispatcher.on('end', () => { msg.member.voiceChannel.leave(); - }) + }); } else if (msg.guild.voiceConnection) { msg.reply('i\'m already playing that lol'); } else { msg.reply('you need to join a voice channel first silly'); } } -} \ No newline at end of file +}; \ No newline at end of file -- cgit v1.2.3