From b856bccd9a1f508650098cf87da622cdad78e25c Mon Sep 17 00:00:00 2001 From: Connor Strand <42255832+Strandxo@users.noreply.github.com> Date: Mon, 22 Apr 2019 17:33:16 +0930 Subject: [PATCH 01/31] Add files via upload --- colours.json | 18 ++++++++ commands/miscellaneous/cat.js | 32 +++++++++++++ commands/miscellaneous/dog.js | 33 +++++++++++++ commands/miscellaneous/help.js | 46 +++++++++++++++++++ commands/miscellaneous/meme.js | 31 +++++++++++++ commands/miscellaneous/ping.js | 19 ++++++++ commands/miscellaneous/report.js | 31 +++++++++++++ commands/miscellaneous/serverinfo.js | 26 +++++++++++ commands/miscellaneous/uptime.js | 23 ++++++++++ commands/miscellaneous/userinfo.js | 28 +++++++++++ commands/moderation/addrole.js | 45 ++++++++++++++++++ commands/moderation/ban.js | 42 +++++++++++++++++ commands/moderation/kick.js | 43 +++++++++++++++++ commands/moderation/mute.js | 69 ++++++++++++++++++++++++++++ commands/moderation/reload.js | 30 ++++++++++++ commands/moderation/removerole.js | 45 ++++++++++++++++++ commands/moderation/say.js | 27 +++++++++++ commands/moderation/shutdown.js | 24 ++++++++++ commands/moderation/softban.js | 46 +++++++++++++++++++ commands/moderation/unban.js | 47 +++++++++++++++++++ commands/moderation/unmute.js | 51 ++++++++++++++++++++ commands/owner/eval.js | 35 ++++++++++++++ events/client/disconnect.js | 5 ++ events/client/error.js | 3 ++ events/client/ready.js | 17 +++++++ events/client/reconnecting.js | 5 ++ events/client/warn.js | 3 ++ events/guild/guildCreate.js | 3 ++ events/guild/guildDelete.js | 3 ++ events/guild/message.js | 12 +++++ handlers/command.js | 13 ++++++ handlers/console.js | 7 +++ handlers/event.js | 13 ++++++ index.js | 8 ++++ start_bot.bat | 2 + 35 files changed, 885 insertions(+) create mode 100644 colours.json create mode 100644 commands/miscellaneous/cat.js create mode 100644 commands/miscellaneous/dog.js create mode 100644 commands/miscellaneous/help.js create mode 100644 commands/miscellaneous/meme.js create mode 100644 commands/miscellaneous/ping.js create mode 100644 commands/miscellaneous/report.js create mode 100644 commands/miscellaneous/serverinfo.js create mode 100644 commands/miscellaneous/uptime.js create mode 100644 commands/miscellaneous/userinfo.js create mode 100644 commands/moderation/addrole.js create mode 100644 commands/moderation/ban.js create mode 100644 commands/moderation/kick.js create mode 100644 commands/moderation/mute.js create mode 100644 commands/moderation/reload.js create mode 100644 commands/moderation/removerole.js create mode 100644 commands/moderation/say.js create mode 100644 commands/moderation/shutdown.js create mode 100644 commands/moderation/softban.js create mode 100644 commands/moderation/unban.js create mode 100644 commands/moderation/unmute.js create mode 100644 commands/owner/eval.js create mode 100644 events/client/disconnect.js create mode 100644 events/client/error.js create mode 100644 events/client/ready.js create mode 100644 events/client/reconnecting.js create mode 100644 events/client/warn.js create mode 100644 events/guild/guildCreate.js create mode 100644 events/guild/guildDelete.js create mode 100644 events/guild/message.js create mode 100644 handlers/command.js create mode 100644 handlers/console.js create mode 100644 handlers/event.js create mode 100644 index.js create mode 100644 start_bot.bat diff --git a/colours.json b/colours.json new file mode 100644 index 0000000..8d99892 --- /dev/null +++ b/colours.json @@ -0,0 +1,18 @@ +{ + "purple_dark": "#6a006a", + "purple_medium": "#a958a5", + "purple_light": "#c481fb", + "orange": "#ffa500", + "gold": "#daa520", + "red_dark": "#8e2430", + "red_light": "#f94343", + "blue_dark": "#3b5998", + "cyan": "#5780cd", + "blue_light": "#ace9e7", + "aqua": "#33a1ee", + "pink": "#ff9dbb", + "green_dark": "#2ac075", + "green_light": "#a1ee33", + "white": "#f9f9f6", + "cream": "#ffdab9" + } \ No newline at end of file diff --git a/commands/miscellaneous/cat.js b/commands/miscellaneous/cat.js new file mode 100644 index 0000000..c9955e2 --- /dev/null +++ b/commands/miscellaneous/cat.js @@ -0,0 +1,32 @@ +const { RichEmbed } = require("discord.js") +const { cyan } = require("../../colours.json"); +const fetch = require('node-fetch'); + +module.exports = { + config: { + name: "cat", + description: "sends a picture of a cat!", + usage: "!cat", + category: "miscellaneous", + accessableby: "Members", + aliases: ["catto"] + }, + run: async (bot, message, args) => { + let msg = await message.channel.send("Generating...") + + fetch(`http://aws.random.cat/meow`) + .then(res => res.json()).then(body => { + if(!body) return message.reply("whoops! I've broke, try again!") + + let cEmbed = new RichEmbed() + .setColor(cyan) + .setAuthor(`${bot.user.username} CATS!`, message.guild.iconURL) + .setImage(body.file) + .setTimestamp() + .setFooter(bot.user.username.toUpperCase(), bot.user.displayAvatarURL) + + message.channel.send(cEmbed) + msg.delete(); + }) + } +} \ No newline at end of file diff --git a/commands/miscellaneous/dog.js b/commands/miscellaneous/dog.js new file mode 100644 index 0000000..1489884 --- /dev/null +++ b/commands/miscellaneous/dog.js @@ -0,0 +1,33 @@ +const { RichEmbed } = require("discord.js") +const { cyan } = require("../../colours.json"); +const fetch = require('node-fetch'); + + +module.exports = { + config: { + name: "dog", + description: "Sends a picture of a dog!", + usage: "!dog", + category: "miscellaneous", + accessableby: "Members", + aliases: ["doggo", "puppy"] + }, + run: async (bot, message, args) => { + let msg = await message.channel.send("Generating...") + + fetch(`https://dog.ceo/api/breeds/image/random`) + .then(res => res.json()).then(body => { + if(!body) return message.reply("whoops! I've broke, try again!") + + let dEmbed = new RichEmbed() + .setColor(cyan) + .setAuthor(`${bot.user.username} DOGS!`, message.guild.iconURL) + .setImage(body.message) + .setTimestamp() + .setFooter(bot.user.username.toUpperCase(), bot.user.displayAvatarURL) + + message.channel.send(dEmbed) + msg.delete(); + }) + } +} \ No newline at end of file diff --git a/commands/miscellaneous/help.js b/commands/miscellaneous/help.js new file mode 100644 index 0000000..b7f7991 --- /dev/null +++ b/commands/miscellaneous/help.js @@ -0,0 +1,46 @@ +const { RichEmbed } = require("discord.js") +const { prefix } = require("../../botconfig.json"); +const { cyan } = require("../../colours.json"); + +module.exports = { + config: { + name: "help", + aliases: ["h", "halp", "commands"], + usage: "!usage", + category: "miscellaneous", + description: "", + accessableby: "Members" + }, + run: async (bot, message, args) => { + let arr = []; + let types = ["Moderation", "Miscellaneous"]; + let embed = new RichEmbed() + + if (!args[0]) { + for(let i = 0; i < types.length; i++) { + arr.push(bot.commands.filter(c => c.config.category == types[i].toLowerCase()).map(c => `\`${c.config.name}\``).join(" ")); + try { + embed.addField(types[i], arr[i]); + } catch (e) { + embed.addBlankField(); + } + } + + embed.setColor(cyan) + .setAuthor(`${message.guild.me.displayName} Help`, message.guild.iconURL) + .setThumbnail(bot.user.displayAvatarURL) + .setTimestamp() + .setDescription(`These are the avaliable commands for the TestBOT!\nThe bot prefix is: **${prefix}**`) + .setFooter("Test Bot 2k19", bot.user.displayAvatarURL) + message.channel.send(embed) + } else { + let command = bot.commands.get(args[0].toLowerCase()) ? bot.commands.get(args[0].toLowerCase()).config : bot.commands.get(bot.aliases.get(args[0].toLowerCase())).config; + + embed.setColor(cyan) + .setAuthor(`${message.guild.me.displayName} Help`, message.guild.iconURL) + .setThumbnail(bot.user.displayAvatarURL) + .setDescription(`The bot prefix is: ${prefix}\n\n**Command:** ${command.name}\n**Description:** ${command.description || "No Description"}\n**Usage:** ${command.usage || "No Usage"}\n**Accessable by:** ${command.accessableby || "Members"}\n**Aliases:** ${command.aliases ? command.aliases.join(", ") : "None"}`) + message.channel.send(embed); + } + } +} \ No newline at end of file diff --git a/commands/miscellaneous/meme.js b/commands/miscellaneous/meme.js new file mode 100644 index 0000000..9ac385e --- /dev/null +++ b/commands/miscellaneous/meme.js @@ -0,0 +1,31 @@ +const { RichEmbed } = require("discord.js") +const { cyan } = require("../../colours.json"); +const fetch = require('node-fetch'); + +module.exports = { + config: { + name: "meme", + description: "Sends a meme from a website!", + usage: "!meme", + category: "miscellaneous", + accessableby: "Members", + }, + run: async (bot, message, args) => { + let msg = await message.channel.send("Generating...") + + fetch(`https://api-to.get-a.life/meme`) + .then(res => res.json()).then(body => { + if(!body) return message.reply("whoops! I've broke, try again!") + + let mEmbed = new RichEmbed() + .setColor(cyan) + .setAuthor(`${bot.user.username} MEMES!`, message.guild.iconURL) + .setImage(body.url) + .setTimestamp() + .setFooter(bot.user.username.toUpperCase(), bot.user.displayAvatarURL) + + message.channel.send(mEmbed) + msg.delete(); + }) + } +} \ No newline at end of file diff --git a/commands/miscellaneous/ping.js b/commands/miscellaneous/ping.js new file mode 100644 index 0000000..ca3fe7d --- /dev/null +++ b/commands/miscellaneous/ping.js @@ -0,0 +1,19 @@ +module.exports = { + config: { + name: "ping", + description: "PONG! Displays the api & bot latency", + usage: "!ping", + category: "miscellaneous", + accessableby: "Members" + }, + run: async (bot, message, args) => { + + message.channel.send("Pinging...").then(m => { + let ping = m.createdTimestamp - message.createdTimestamp + let choices = ["Is this really my ping", "Is it okay? I cant look", "I hope it isnt bad"] + let response = choices[Math.floor(Math.random() * choices.length)] + + m.edit(`${response}: Bot Latency: \`${ping}\`, API Latency: \`${Math.round(bot.ping)}\``) + }) + } +} \ No newline at end of file diff --git a/commands/miscellaneous/report.js b/commands/miscellaneous/report.js new file mode 100644 index 0000000..9b02224 --- /dev/null +++ b/commands/miscellaneous/report.js @@ -0,0 +1,31 @@ +module.exports = { + config: { + name: "report", + description: "reports a user of the guild", + usage: "!report ", + accessableby: "Members", + }, + run: async (bot, message, args) => { + + message.delete() + // mentioned or grabbed user + let target = message.mentions.members.first() || message.guild.members.get(args[0]) + if(!target) return message.channel.send("Please provide a valid user").then(m => m.delete(15000)) + + // reasoning definition + let reason = args.slice(1).join(" ") + if(!reason) return message.channel.send(`Please provide a reason for reporting **${target.user.tag}**`).then(m => m.delete(15000)) + + // grab reports channel + let sChannel = message.guild.channels.find(x => x.name === "tut-reports") + + // send to reports channel and add tick or cross + + message.channel.send("Your report has been filed to the staff team. Thank you!").then(m => m.delete(15000)) + sChannel.send(`**${message.author.tag}** has reported **${target.user.tag}** for **${reason}**.`).then(async msg => { + await msg.react("✅") + await msg.react("❌") + }) + + } +} diff --git a/commands/miscellaneous/serverinfo.js b/commands/miscellaneous/serverinfo.js new file mode 100644 index 0000000..dd8984c --- /dev/null +++ b/commands/miscellaneous/serverinfo.js @@ -0,0 +1,26 @@ +const { RichEmbed } = require("discord.js") +const { cyan } = require("../../colours.json"); + +module.exports = { + config: { + name: "serverinfo", + description: "Pulls the serverinfo of the guild!", + usage: "!serverinfo", + category: "miscellaneous", + accessableby: "Members", + aliases: ["si", "serverdesc"] + }, + run: async (bot, message, args) => { + let sEmbed = new RichEmbed() + .setColor(cyan) + .setTitle("Server Info") + .setThumbnail(message.guild.iconURL) + .setAuthor(`${message.guild.name} Info`, message.guild.iconURL) + .addField("**Guild Name:**", `${message.guild.name}`, true) + .addField("**Guild Owner:**", `${message.guild.owner}`, true) + .addField("**Member Count:**", `${message.guild.memberCount}`, true) + .addField("**Role Count:**", `${message.guild.roles.size}`, true) + .setFooter(`TestBot | Footer`, bot.user.displayAvatarURL); + message.channel.send(sEmbed); + } +} \ No newline at end of file diff --git a/commands/miscellaneous/uptime.js b/commands/miscellaneous/uptime.js new file mode 100644 index 0000000..2b5f54e --- /dev/null +++ b/commands/miscellaneous/uptime.js @@ -0,0 +1,23 @@ +module.exports = { + config: { + name: "uptime", + description: "Displays the bots current uptime!", + usage: "!uptime", + category: "miscellaneous", + accessableby: "Members", + aliases: ["ut"] + }, + run: async (bot, message, args) => { + + function duration(ms) { + const sec = Math.floor((ms / 1000) % 60).toString() + const min = Math.floor((ms / (1000 * 60)) % 60).toString() + const hrs = Math.floor((ms / (1000 * 60 * 60)) % 60).toString() + const days = Math.floor((ms / (1000 * 60 * 60 * 24)) % 60).toString() + return `${days.padStart(1, '0')} days, ${hrs.padStart(2, '0')} hours, ${min.padStart(2, '0')} minutes, ${sec.padStart(2, '0')} seconds, ` + } + + message.channel.send(`I have been online for: ${duration(bot.uptime)}`) + + } +} diff --git a/commands/miscellaneous/userinfo.js b/commands/miscellaneous/userinfo.js new file mode 100644 index 0000000..7792b1f --- /dev/null +++ b/commands/miscellaneous/userinfo.js @@ -0,0 +1,28 @@ +const { RichEmbed } = require("discord.js") +const { red_light } = require("../../colours.json"); + +module.exports = { + config: { + name: "userinfo", + description: "Pulls the userinfo of yourself or a user!", + usage: "!userinfo (@mention)", + category: "miscellaneous", + accessableby: "Members", + aliases: ["ui"] + }, + run: async (bot, message, args) => { + let uEmbed = new RichEmbed() + .setColor(red_light) + .setTitle("User Info") + .setThumbnail(message.guild.iconURL) + .setAuthor(`${message.author.username} Info`, message.author.displayAvatarURL) + .addField("**Username:**", `${message.author.username}`, true) + .addField("**Discriminator:**", `${message.author.discriminator}`, true) + .addField("**ID:**", `${message.author.id}`, true) + .addField("**Status:**", `${message.author.presence.status}`, true) + .addField("**Created At:**", `${message.author.createdAt}`, true) + .setFooter(`TestBot | Footer`, bot.user.displayAvatarURL); + + message.channel.send(uEmbed); + } +} diff --git a/commands/moderation/addrole.js b/commands/moderation/addrole.js new file mode 100644 index 0000000..4bc2cd1 --- /dev/null +++ b/commands/moderation/addrole.js @@ -0,0 +1,45 @@ +const { RichEmbed } = require("discord.js") +const { redlight } = require("../../colours.json") + +module.exports= { + config: { + name: "addrole", + description: "Adds a role to a member of the guild!", + usage: "!addrole", + category: "moderation", + accessableby: "Moderators", + aliases: ["ar", "roleadd"] + }, + run: async (bot, message, args) => { + + if(!message.member.hasPermission(["MANAGE_ROLES", "ADMINISTRATOR"])) return message.channel.send("You dont have permission to perform this command!") + + let rMember = message.mentions.members.first() || message.guild.members.find(m => m.user.tag === args[0]) || message.guild.members.get(args[0]) + if(!rMember) return message.channel.send("Please provide a user to add a role too.") + let role = message.guild.roles.find(r => r.name == args[1]) || message.guild.roles.find(r => r.id == args[1]) || message.mentions.roles.first() + if(!role) return message.channel.send("Please provide a role to add to said user.") + let reason = args.slice(2).join(" ") + if(!reason) return message.channel.send("Please provide a reason") + + if(!message.guild.me.hasPermission(["MANAGE_ROLES", "ADMINISTRATOR"])) return message.channel.send("I don't have permission to perform this command.") + + if(rMember.roles.has(role.id)) { + return message.channel.send(`${rMember.displayName}, already has the role!`) + } else { + await rMember.addRole(role.id).catch(e => console.log(e.message)) + message.channel.send(`The role, ${role.name}, has been added to ${rMember.displayName}.`) + } + + let embed = new RichEmbed() + .setColor(redlight) + .setAuthor(`${message.guild.name} Modlogs`, message.guild.iconURL) + .addField("Moderation:", "Addrole") + .addField("Mutee:", rMember.user.username) + .addField("Moderator:", message.author.username) + .addField("Reason:", reason) + .addField("Date:", message.createdAt.toLocaleString()) + + let sChannel = message.guild.channels.find(c => c.name === "tut-modlogs") + sChannel.send(embed) + } +} \ No newline at end of file diff --git a/commands/moderation/ban.js b/commands/moderation/ban.js new file mode 100644 index 0000000..182925f --- /dev/null +++ b/commands/moderation/ban.js @@ -0,0 +1,42 @@ +const { RichEmbed } = require("discord.js") +const { redlight } = require("../../colours.json"); + +module.exports = { + config: { + name: "ban", + description: "Bans a user from the guild!", + usage: "!ban", + category: "moderation", + accessableby: "Administrators", + aliases: ["b", "banish", "remove"] + }, + run: async (bot, message, args) => { + + if(!message.member.hasPermission(["BAN_MEMBERS", "ADMINISTRATOR"])) return message.channel.send("You do not have permission to perform this command!") + + let banMember = message.mentions.members.first() || message.guild.members.get(args[0]) + if(!banMember) return message.channel.send("Please provide a user to ban!") + + let reason = args.slice(1).join(" "); + if(!reason) reason = "No reason given!" + + if(!message.guild.me.hasPermission(["BAN_MEMBERS", "ADMINISTRATOR"])) return message.channel.send("I dont have permission to perform this command") + + banMember.send(`Hello, you have been banned from ${message.guild.name} for: ${reason}`).then(() => + message.guild.ban(banMember, { days: 1, reason: reason})).catch(err => console.log(err)) + + message.channel.send(`**${banMember.user.tag}** has been banned`).then(m => m.delete(5000)) + + let embed = new RichEmbed() + .setColor(redlight) + .setAuthor(`${message.guild.name} Modlogs`, message.guild.iconURL) + .addField("Moderation:", "ban") + .addField("Mutee:", banMember.user.username) + .addField("Moderator:", message.author.username) + .addField("Reason:", reason) + .addField("Date:", message.createdAt.toLocaleString()) + + let sChannel = message.guild.channels.find(c => c.name === "tut-modlogs") + sChannel.send(embed) + } +} \ No newline at end of file diff --git a/commands/moderation/kick.js b/commands/moderation/kick.js new file mode 100644 index 0000000..6967b91 --- /dev/null +++ b/commands/moderation/kick.js @@ -0,0 +1,43 @@ +const { RichEmbed } = require("discord.js") +const { redlight } = require("../../colours.json"); + +module.exports = { + config: { + name: "kick", + description: "Kick a user from the guild!", + usage: "!kick", + category: "moderation", + accessableby: "Moderator", + aliases: ["k"] + }, + run: async (bot, message, args) => { + + if(!message.member.hasPermission(["KICK_MEMBERS", "ADMINISTRATOR"])) return message.channel.send("You dont have permission to perform this command!") + + let kickMember = message.mentions.members.first() || message.guild.members.get(args[0]) + if(!kickMember) return message.channel.send("Please provide a user to kick!") + + let reason = args.slice(1).join(" ") + if(!reason) reason = "No reason given!" + + if(!message.guild.me.hasPermission(["KICK_MEMBERS", "ADMINISTRATOR"])) return message.channel.send("I dont have permission to do this!") + + kickMember.send(`Hello, you have been kicked from ${message.guild.name} for: ${reason}`).then(() => + kickMember.kick()).catch(err => console.log(err)) + + message.channel.send(`**${kickMember.user.tag}** has been kicked`).then(m => m.delete(5000)) + + let embed = new RichEmbed() + .setColor(redlight) + .setAuthor(`${message.guild.name} Modlogs`, message.guild.iconURL) + .addField("Moderation:", "kick") + .addField("Mutee:", kickMember.user.username) + .addField("Moderator:", message.author.username) + .addField("Reason:", reason) + .addField("Date:", message.createdAt.toLocaleString()) + + let sChannel = message.guild.channels.find(c => c.name === "tut-modlogs") + sChannel.send(embed) + + } +} \ No newline at end of file diff --git a/commands/moderation/mute.js b/commands/moderation/mute.js new file mode 100644 index 0000000..9e3d5c5 --- /dev/null +++ b/commands/moderation/mute.js @@ -0,0 +1,69 @@ +const { RichEmbed } = require("discord.js") +const { redlight } = require("../../colours.json"); + +module.exports = { + config: { + name: "mute", + description: "Mutes a member in the discord!", + usage: "!mute ", + category: "moderation", + accessableby: "Members", + aliases: ["m", "nospeak"] + }, + run: async (bot, message, args) => { +// check if the command caller has permission to use the command +if(!message.member.hasPermission("MANAGE_ROLES") || !message.guild.owner) return message.channel.send("You dont have permission to use this command."); + +if(!message.guild.me.hasPermission(["MANAGE_ROLES", "ADMINISTRATOR"])) return message.channel.send("I don't have permission to add roles!") + +//define the reason and mutee +let mutee = message.mentions.members.first() || message.guild.members.get(args[0]); +if(!mutee) return message.channel.send("Please supply a user to be muted!"); + +let reason = args.slice(1).join(" "); +if(!reason) reason = "No reason given" + +//define mute role and if the mute role doesnt exist then create one +let muterole = message.guild.roles.find(r => r.name === "Muted") +if(!muterole) { + try{ + muterole = await message.guild.createRole({ + name: "Muted", + color: "#514f48", + permissions: [] + }) + message.guild.channels.forEach(async (channel, id) => { + await channel.overwritePermissions(muterole, { + SEND_MESSAGES: false, + ADD_REACTIONS: false, + SEND_TTS_MESSAGES: false, + ATTACH_FILES: false, + SPEAK: false + }) + }) + } catch(e) { + console.log(e.stack); + } +} + +//add role to the mentioned user and also send the user a dm explaing where and why they were muted +mutee.addRole(muterole.id).then(() => { + message.delete() + mutee.send(`Hello, you have been in ${message.guild.name} for: ${reason}`).catch(err => console.log(err)) + message.channel.send(`${mutee.user.username} was successfully muted.`) +}) + +//send an embed to the modlogs channel +let embed = new RichEmbed() + .setColor(redlight) + .setAuthor(`${message.guild.name} Modlogs`, message.guild.iconURL) + .addField("Moderation:", "mute") + .addField("Mutee:", mutee.user.username) + .addField("Moderator:", message.author.username) + .addField("Reason:", reason) + .addField("Date:", message.createdAt.toLocaleString()) + +let sChannel = message.guild.channels.find(c => c.name === "tut-modlogs") +sChannel.send(embed) + } +} \ No newline at end of file diff --git a/commands/moderation/reload.js b/commands/moderation/reload.js new file mode 100644 index 0000000..56802f3 --- /dev/null +++ b/commands/moderation/reload.js @@ -0,0 +1,30 @@ +module.exports = { + config: { + name: "reload", + description: "reloads a bot command!", + usage: "!reload", + category: "moderation", + accessableby: "Bot Owner", + aliases: ["creload"] + }, + run: async (bot, message, args) => { + + if(message.author.id != "203104843479515136") return message.channel.send("You're the bot the owner!") + + if(!args[0]) return message.channel.send("Please provide a command to reload!") + + let commandName = args[0].toLowerCase() + + try { + delete require.cache[require.resolve(`./${commandName}.js`)] // usage !reload + bot.commands.delete(commandName) + const pull = require(`./${commandName}.js`) + bot.commands.set(commandName, pull) + } catch(e) { + return message.channel.send(`Could not reload: \`${args[0].toUpperCase()}\``) + } + + message.channel.send(`The command \`${args[0].toUpperCase()}\` has been reloaded!`) + + } +} \ No newline at end of file diff --git a/commands/moderation/removerole.js b/commands/moderation/removerole.js new file mode 100644 index 0000000..c7190a1 --- /dev/null +++ b/commands/moderation/removerole.js @@ -0,0 +1,45 @@ +const { RichEmbed } = require("discord.js") +const { redlight } = require("../../colours.json"); + +module.exports = { + config: { + name: "removerole", + description: "Removes a role to a member of the guild!", + usage: "!removerole", + category: "moderation", + accessableby: "Moderators", + aliases: ["rr", "roleremove"] + }, + run: async (bot, message, args) => { + + if(!message.member.hasPermission(["MANAGE_ROLES", "ADMINISTRATOR"])) return message.channel.send("You dont have permission to perform this command!") + + let rMember = message.mentions.members.first() || message.guild.members.find(m => m.user.tag === args[0]) || message.guild.members.get(args[0]) + if(!rMember) return message.channel.send("Please provide a user to remove a role too.") + let role = message.guild.roles.find(r => r.name == args[1]) || message.guild.roles.find(r => r.id == args[1]) || message.mentions.roles.first() + if(!role) return message.channel.send("Please provide a role to remove from said user.") + let reason = args.slice(2).join(" ") + if(!reason) return message.channel.send("Please provide a reason") + + if(!message.guild.me.hasPermission(["MANAGE_ROLES", "ADMINISTRATOR"])) return message.channel.send("I don't have permission to perform this command.") + + if(!rMember.roles.has(role.id)) { + return message.channel.send(`${rMember.displayName}, doesnt have the role!`) + } else { + await rMember.removeRole(role.id).catch(e => console.log(e.message)) + message.channel.send(`The role, ${role.name}, has been removed from ${rMember.displayName}.`) + } + + let embed = new RichEmbed() + .setColor(redlight) + .setAuthor(`${message.guild.name} Modlogs`, message.guild.iconURL) + .addField("Moderation:", "Addrole") + .addField("Mutee:", rMember.user.username) + .addField("Moderator:", message.author.username) + .addField("Reason:", reason) + .addField("Date:", message.createdAt.toLocaleString()) + + let sChannel = message.guild.channels.find(c => c.name === "tut-modlogs") + sChannel.send(embed) + } +} \ No newline at end of file diff --git a/commands/moderation/say.js b/commands/moderation/say.js new file mode 100644 index 0000000..e23403c --- /dev/null +++ b/commands/moderation/say.js @@ -0,0 +1,27 @@ +module.exports = { + config: { + name: "say", + description: "sends a message that was inputted to a channel", + usage: "!say", + category: "moderation", + accessableby: "Staff", + aliases: ["acc", "announcement"] + }, + run: async (bot, message, args) => { + + if(!message.member.hasPermission(["MANAGE_MESSAGES", "ADMINISTRATOR"])) return message.channel.send("You can not use this command!") + + let argsresult; + let mChannel = message.mentions.channels.first() + + message.delete() + if(mChannel) { + argsresult = args.slice(1).join(" ") + mChannel.send(argsresult) + } else { + argsresult = args.join(" ") + message.channel.send(argsresult) + } + + } +} \ No newline at end of file diff --git a/commands/moderation/shutdown.js b/commands/moderation/shutdown.js new file mode 100644 index 0000000..a28c61d --- /dev/null +++ b/commands/moderation/shutdown.js @@ -0,0 +1,24 @@ +module.exports = { + config: { + name: "shutdown", + description: "shuts down the bot!", + usage: "!shutdown", + category: "moderation", + accessableby: "Bot Owner", + aliases: ["botstop"] + }, + run: async (bot, message, args) => { + + if(message.author.id != "203104843479515136") return message.channel.send("You're the bot the owner!") + + try { + await message.channel.send("Bot is shutting down...") + process.exit() + } catch(e) { + message.channel.send(`ERROR: ${e.message}`) + } + + + + } +} \ No newline at end of file diff --git a/commands/moderation/softban.js b/commands/moderation/softban.js new file mode 100644 index 0000000..af15534 --- /dev/null +++ b/commands/moderation/softban.js @@ -0,0 +1,46 @@ +const { RichEmbed } = require("discord.js") +const { redlight } = require("../../colours.json"); + +module.exports = { + config: { + name: "softban", + description: "Softbans a user from the guild!", + usage: "!softban", + category: "moderation", + accessableby: "Administrators", + aliases: ["sb", "sbanish", "sremove"] + }, + run: async (bot, message, args) => { + + if(!message.member.hasPermission(["BAN_MEMBERS", "ADMINISTRATOR"])) return message.channel.send("You do not have permission to perform this command!") + + let banMember = message.mentions.members.first() || message.guild.members.get(args[0]) + if(!banMember) return message.channel.send("Please provide a user to ban!") + + let reason = args.slice(1).join(" "); + if(!reason) reason = "No reason given!" + + if(!message.guild.me.hasPermission(["BAN_MEMBERS", "ADMINISTRATOR"])) return message.channel.send("I dont have permission to perform this command") + + banMember.send(`Hello, you have been banned from ${message.guild.name} for: ${reason}`).then(() => + message.guild.ban(banMember, { days: 1, reason: reason})).then(() => message.guild.unban(banMember.id, { reason: "Softban"})).catch(err => console.log(err)) + + message.channel.send(`**${banMember.user.tag}** has been banned`).then(m => m.delete(5000)) + + let embed = new RichEmbed() + .setColor(redlight) + .setAuthor(`${message.guild.name} Modlogs`, message.guild.iconURL) + .addField("Moderation:", "ban") + .addField("Mutee:", banMember.user.username) + .addField("Moderator:", message.author.username) + .addField("Reason:", reason) + .addField("Date:", message.createdAt.toLocaleString()) + + let sChannel = message.guild.channels.find(c => c.name === "tut-modlogs") + sChannel.send(embed) + + + + + } +} \ No newline at end of file diff --git a/commands/moderation/unban.js b/commands/moderation/unban.js new file mode 100644 index 0000000..6a8e05f --- /dev/null +++ b/commands/moderation/unban.js @@ -0,0 +1,47 @@ +const { RichEmbed } = require("discord.js") +const { redlight } = require("../../colours.json"); + +module.exports = { + config: { + name: "unban", + description: "Unban a user from the guild!", + usage: "!unban", + category: "moderation", + accessableby: "Administrators", + aliases: ["ub", "unbanish"] + }, + run: async (bot, message, args) => { + + if(!message.member.hasPermission(["BAN_MEMBERS", "ADMINISTRATOR"])) return message.channel.send("You dont have permission to perform this command!") + + + if(isNaN(args[0])) return message.channel.send("You need to provide an ID.") + let bannedMember = await bot.fetchUser(args[0]) + if(!bannedMember) return message.channel.send("Please provide a user id to unban someone!") + + let reason = args.slice(1).join(" ") + if(!reason) reason = "No reason given!" + + if(!message.guild.me.hasPermission(["BAN_MEMBERS", "ADMINISTRATOR"])) return message.channel.send("I dont have permission to perform this command!")| + message.delete() + try { + message.guild.unban(bannedMember, {reason: reason}) + message.channel.send(`${bannedMember.tag} has been unbanned from the guild!`) + } catch(e) { + console.log(e.message) + } + + let embed = new RichEmbed() + .setColor(redlight) + .setAuthor(`${message.guild.name} Modlogs`, message.guild.iconURL) + .addField("Moderation:", "unban") + .addField("Moderated on:", `${bannedMember.username} (${bannedMember.id})`) + .addField("Moderator:", message.author.username) + .addField("Reason:", reason) + .addField("Date:", message.createdAt.toLocaleString()) + + let sChannel = message.guild.channels.find(c => c.name === "tut-modlogs") + sChannel.send(embed) + + } +} \ No newline at end of file diff --git a/commands/moderation/unmute.js b/commands/moderation/unmute.js new file mode 100644 index 0000000..58694b1 --- /dev/null +++ b/commands/moderation/unmute.js @@ -0,0 +1,51 @@ +const { RichEmbed } = require("discord.js") +const { redlight } = require("../../colours.json"); + +module.exports = { + config: { + name: "unmute", + description: "Unmutes a member in the discord!", + usage: "!unmute ", + category: "moderation", + accessableby: "Members", + aliases: ["unm", "speak"] + }, + run: async (bot, message, args) => { +// check if the command caller has permission to use the command +if(!message.member.hasPermission("MANAGE_ROLES") || !message.guild.owner) return message.channel.send("You dont have permission to use this command."); + +if(!message.guild.me.hasPermission(["MANAGE_ROLES", "ADMINISTRATOR"])) return message.channel.send("I don't have permission to add roles!") + +//define the reason and unmutee +let mutee = message.mentions.members.first() || message.guild.members.get(args[0]); +if(!mutee) return message.channel.send("Please supply a user to be muted!"); + +let reason = args.slice(1).join(" "); +if(!reason) reason = "No reason given" + +//define mute role and if the mute role doesnt exist then send a message +let muterole = message.guild.roles.find(r => r.name === "Muted") +if(!muterole) return message.channel.send("There is no mute role to remove!") + +//remove role to the mentioned user and also send the user a dm explaing where and why they were unmuted +mutee.removeRole(muterole.id).then(() => { + message.delete() + mutee.send(`Hello, you have been unmuted in ${message.guild.name} for: ${reason}`).catch(err => console.log(err)) + message.channel.send(`${mutee.user.username} was unmuted!`) +}) + +//send an embed to the modlogs channel +let embed = new RichEmbed() +.setColor(redlight) +.setAuthor(`${message.guild.name} Modlogs`, message.guild.iconURL) +.addField("Moderation:", "unmute") +.addField("Mutee:", mutee.user.username) +.addField("Moderator:", message.author.username) +.addField("Reason:", reason) +.addField("Date:", message.createdAt.toLocaleString()) + +let sChannel = message.guild.channels.find(c => c.name === "tut-modlogs") +sChannel.send(embed) + + } +} \ No newline at end of file diff --git a/commands/owner/eval.js b/commands/owner/eval.js new file mode 100644 index 0000000..0e47dca --- /dev/null +++ b/commands/owner/eval.js @@ -0,0 +1,35 @@ +const { ownerid, prefix } = require("../../botconfig.json"); +const { inspect } = require("util") + +module.exports = { + config: { + name: "eval", + description: "Evaluates code", + accessableby: "Bot Owner", + type: "owner", + usage: `${prefix}eval ` + }, + run: async (bot, message, args) => { + if(message.author.id == ownerid) { + try { + let toEval = args.join(" ") + let evaluated = inspect(eval(toEval, { depth: 0 })); + + if (!toEval) { + return message.channel.send(`Error while evaluating: \`air\``); + } else { + let hrStart = process.hrtime() + let hrDiff; + hrDiff = process.hrtime(hrStart); + return message.channel.send(`*Executed in ${hrDiff[0] > 0 ? `${hrDiff[0]}s ` : ''}${hrDiff[1] / 1000000}ms.*\n\`\`\`javascript\n${evaluated}\n\`\`\``, { maxLength: 1900 }) + } + + } catch (e) { + return message.channel.send(`Error while evaluating: \`${e.message}\``); + } + + } else { + return message.reply(" you are not the bot owner!").then(msg => msg.delete(5000)) + } + } +} \ No newline at end of file diff --git a/events/client/disconnect.js b/events/client/disconnect.js new file mode 100644 index 0000000..472a49c --- /dev/null +++ b/events/client/disconnect.js @@ -0,0 +1,5 @@ +const dateformat = require("dateformat"); + +module.exports = () => { + console.log(`you have been disconnected at ${dateformat(new Date(), "dddd, mmmm dS, yyyy, h:MM:ss TT")}.`) +} \ No newline at end of file diff --git a/events/client/error.js b/events/client/error.js new file mode 100644 index 0000000..7e31f41 --- /dev/null +++ b/events/client/error.js @@ -0,0 +1,3 @@ +module.exports = e => { + console.log(e); +} \ No newline at end of file diff --git a/events/client/ready.js b/events/client/ready.js new file mode 100644 index 0000000..63e4453 --- /dev/null +++ b/events/client/ready.js @@ -0,0 +1,17 @@ +module.exports = async bot => { + console.log(`${bot.user.username} is online`) + // bot.user.setActivity("Hello", {type: "STREAMING", url:"https://twitch.tv/Strandable"}); + + let statuses = [ + `${bot.guilds.size} servers!`, + "!help", + `over ${bot.users.size} users!` + ] + + setInterval(function() { + let status = statuses[Math.floor(Math.random() * statuses.length)]; + bot.user.setActivity(status, {type: "WATCHING"}); + + }, 5000) + +} \ No newline at end of file diff --git a/events/client/reconnecting.js b/events/client/reconnecting.js new file mode 100644 index 0000000..f355700 --- /dev/null +++ b/events/client/reconnecting.js @@ -0,0 +1,5 @@ +const dateformat = require("dateformat"); + +module.exports = () => { + console.log(`Reconnecting at ${dateformat(new Date(), "dddd, mmmm dS, yyyy, h:MM:ss TT")}.`) +} \ No newline at end of file diff --git a/events/client/warn.js b/events/client/warn.js new file mode 100644 index 0000000..dfa1867 --- /dev/null +++ b/events/client/warn.js @@ -0,0 +1,3 @@ +module.exports = w => { + console.log(w); +} \ No newline at end of file diff --git a/events/guild/guildCreate.js b/events/guild/guildCreate.js new file mode 100644 index 0000000..98a3aab --- /dev/null +++ b/events/guild/guildCreate.js @@ -0,0 +1,3 @@ +module.exports = async (guild, bot) => { + bot.channels.get("ID").send("Hello") +} \ No newline at end of file diff --git a/events/guild/guildDelete.js b/events/guild/guildDelete.js new file mode 100644 index 0000000..5cca873 --- /dev/null +++ b/events/guild/guildDelete.js @@ -0,0 +1,3 @@ +module.exports = async (guild, bot) => { + bot.channels.get("ID").send("Bye") +} \ No newline at end of file diff --git a/events/guild/message.js b/events/guild/message.js new file mode 100644 index 0000000..70ccb33 --- /dev/null +++ b/events/guild/message.js @@ -0,0 +1,12 @@ +const { prefix } = require("../../botconfig.json"); + +module.exports = async (bot, message) => { + if(message.author.bot || message.channel.type === "dm") return; + + let args = message.content.slice(prefix.length).trim().split(/ +/g); + let cmd = args.shift().toLowerCase(); + + if(!message.content.startsWith(prefix)) return; + let commandfile = bot.commands.get(cmd) || bot.commands.get(bot.aliases.get(cmd)) + if(commandfile) commandfile.run(bot, message, args) +} \ No newline at end of file diff --git a/handlers/command.js b/handlers/command.js new file mode 100644 index 0000000..2fedb68 --- /dev/null +++ b/handlers/command.js @@ -0,0 +1,13 @@ +const { readdirSync } = require("fs") + +module.exports = (bot) => { + const load = dirs => { + const commands = readdirSync(`./commands/${dirs}/`).filter(d => d.endsWith('.js')); + for (let file of commands) { + let pull = require(`../commands/${dirs}/${file}`); + bot.commands.set(pull.config.name, pull); + if (pull.config.aliases) pull.config.aliases.forEach(a => bot.aliases.set(a, pull.config.name)); + }; + }; + ["miscellaneous", "moderation", "owner"].forEach(x => load(x)); +}; \ No newline at end of file diff --git a/handlers/console.js b/handlers/console.js new file mode 100644 index 0000000..e9c4381 --- /dev/null +++ b/handlers/console.js @@ -0,0 +1,7 @@ +module.exports = (bot) => { +let prompt = process.openStdin() +prompt.addListener("data", res => { + let x = res.toString().trim().split(/ +/g) + bot.channels.get("555039958121971736").send(x.join(" ")); + }); +} \ No newline at end of file diff --git a/handlers/event.js b/handlers/event.js new file mode 100644 index 0000000..1076cda --- /dev/null +++ b/handlers/event.js @@ -0,0 +1,13 @@ +const { readdirSync } = require("fs") + +module.exports = (bot) => { + const load = dirs => { + const events = readdirSync(`./events/${dirs}/`).filter(d => d.endsWith('.js')); + for (let file of events) { + const evt = require(`../events/${dirs}/${file}`); + let eName = file.split('.')[0]; + bot.on(eName, evt.bind(null, bot)); + }; + }; + ["client", "guild"].forEach(x => load(x)); +}; \ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 0000000..8dacaaf --- /dev/null +++ b/index.js @@ -0,0 +1,8 @@ +const { Client, Collection } = require("discord.js"); +const { token } = require("./botconfig.json"); +const bot = new Client(); + +["aliases", "commands"].forEach(x => bot[x] = new Collection()); +["console", "command", "event"].forEach(x => require(`./handlers/${x}`)(bot)); + +bot.login(token); \ No newline at end of file diff --git a/start_bot.bat b/start_bot.bat new file mode 100644 index 0000000..c212ea0 --- /dev/null +++ b/start_bot.bat @@ -0,0 +1,2 @@ +nodemon index.js +PAUSE From 7d0f2c1de916d09f46df7d6da728f9e6fa035dc7 Mon Sep 17 00:00:00 2001 From: Connor Strand <42255832+Strandxo@users.noreply.github.com> Date: Wed, 24 Apr 2019 23:32:03 +0930 Subject: [PATCH 02/31] Delete guildCreate.js --- events/guild/guildCreate.js | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 events/guild/guildCreate.js diff --git a/events/guild/guildCreate.js b/events/guild/guildCreate.js deleted file mode 100644 index 98a3aab..0000000 --- a/events/guild/guildCreate.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = async (guild, bot) => { - bot.channels.get("ID").send("Hello") -} \ No newline at end of file From 6a6ab8facf559d94434de35d96d25751ca449c38 Mon Sep 17 00:00:00 2001 From: Connor Strand <42255832+Strandxo@users.noreply.github.com> Date: Wed, 24 Apr 2019 23:32:12 +0930 Subject: [PATCH 03/31] Delete guildDelete.js --- events/guild/guildDelete.js | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 events/guild/guildDelete.js diff --git a/events/guild/guildDelete.js b/events/guild/guildDelete.js deleted file mode 100644 index 5cca873..0000000 --- a/events/guild/guildDelete.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = async (guild, bot) => { - bot.channels.get("ID").send("Bye") -} \ No newline at end of file From 299f04e92bd033a6f39309116a83813e005bcfc8 Mon Sep 17 00:00:00 2001 From: Connor Strand <42255832+Strandxo@users.noreply.github.com> Date: Thu, 25 Apr 2019 18:03:59 +0930 Subject: [PATCH 04/31] Delete disconnect.js --- events/client/disconnect.js | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 events/client/disconnect.js diff --git a/events/client/disconnect.js b/events/client/disconnect.js deleted file mode 100644 index 472a49c..0000000 --- a/events/client/disconnect.js +++ /dev/null @@ -1,5 +0,0 @@ -const dateformat = require("dateformat"); - -module.exports = () => { - console.log(`you have been disconnected at ${dateformat(new Date(), "dddd, mmmm dS, yyyy, h:MM:ss TT")}.`) -} \ No newline at end of file From 3d290ac2130ae98b9861d236c54a6e2284a36e45 Mon Sep 17 00:00:00 2001 From: Connor Strand <42255832+Strandxo@users.noreply.github.com> Date: Thu, 25 Apr 2019 18:04:06 +0930 Subject: [PATCH 05/31] Delete error.js --- events/client/error.js | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 events/client/error.js diff --git a/events/client/error.js b/events/client/error.js deleted file mode 100644 index 7e31f41..0000000 --- a/events/client/error.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = e => { - console.log(e); -} \ No newline at end of file From 5dfa6e5c847943bacd7a499ea29c2491b87b298e Mon Sep 17 00:00:00 2001 From: Connor Strand <42255832+Strandxo@users.noreply.github.com> Date: Thu, 25 Apr 2019 18:04:14 +0930 Subject: [PATCH 06/31] Delete reconnecting.js --- events/client/reconnecting.js | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 events/client/reconnecting.js diff --git a/events/client/reconnecting.js b/events/client/reconnecting.js deleted file mode 100644 index f355700..0000000 --- a/events/client/reconnecting.js +++ /dev/null @@ -1,5 +0,0 @@ -const dateformat = require("dateformat"); - -module.exports = () => { - console.log(`Reconnecting at ${dateformat(new Date(), "dddd, mmmm dS, yyyy, h:MM:ss TT")}.`) -} \ No newline at end of file From 9f681a9127c231e7dc5b3e1d60c04e01a1ea265a Mon Sep 17 00:00:00 2001 From: Connor Strand <42255832+Strandxo@users.noreply.github.com> Date: Thu, 25 Apr 2019 18:04:21 +0930 Subject: [PATCH 07/31] Delete warn.js --- events/client/warn.js | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 events/client/warn.js diff --git a/events/client/warn.js b/events/client/warn.js deleted file mode 100644 index dfa1867..0000000 --- a/events/client/warn.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = w => { - console.log(w); -} \ No newline at end of file From 81b5dd4ae218347d7ef07354c906956725ce5ba7 Mon Sep 17 00:00:00 2001 From: Connor Strand <42255832+Strandxo@users.noreply.github.com> Date: Mon, 6 May 2019 00:21:28 +0930 Subject: [PATCH 08/31] Update unban.js --- commands/moderation/unban.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/moderation/unban.js b/commands/moderation/unban.js index 6a8e05f..9c580bd 100644 --- a/commands/moderation/unban.js +++ b/commands/moderation/unban.js @@ -25,7 +25,7 @@ module.exports = { if(!message.guild.me.hasPermission(["BAN_MEMBERS", "ADMINISTRATOR"])) return message.channel.send("I dont have permission to perform this command!")| message.delete() try { - message.guild.unban(bannedMember, {reason: reason}) + message.guild.unban(bannedMember, reason) message.channel.send(`${bannedMember.tag} has been unbanned from the guild!`) } catch(e) { console.log(e.message) @@ -44,4 +44,4 @@ module.exports = { sChannel.send(embed) } -} \ No newline at end of file +} From 7649bc907d252ab207f11be126226c60a2e1bcf1 Mon Sep 17 00:00:00 2001 From: Connor Strand <42255832+Strandxo@users.noreply.github.com> Date: Mon, 3 Jun 2019 09:06:59 +0930 Subject: [PATCH 09/31] Episode 21 Help Command! --- commands/miscellaneous/help.js | 72 +++++++++++++++++++--------------- 1 file changed, 40 insertions(+), 32 deletions(-) diff --git a/commands/miscellaneous/help.js b/commands/miscellaneous/help.js index b7f7991..39d44b9 100644 --- a/commands/miscellaneous/help.js +++ b/commands/miscellaneous/help.js @@ -1,46 +1,54 @@ -const { RichEmbed } = require("discord.js") +const { RichEmbed } = require("discord.js"); const { prefix } = require("../../botconfig.json"); -const { cyan } = require("../../colours.json"); +const { readdirSync } = require("fs") +const { stripIndents } = require("common-tags") +const { cyan } = require("../../colours.json") module.exports = { config: { name: "help", aliases: ["h", "halp", "commands"], - usage: "!usage", + usage: "(command)", category: "miscellaneous", - description: "", + description: "Displays all commands that the bot has.", accessableby: "Members" }, run: async (bot, message, args) => { - let arr = []; - let types = ["Moderation", "Miscellaneous"]; - let embed = new RichEmbed() + const embed = new RichEmbed() + .setColor(cyan) + .setAuthor(`${message.guild.me.displayName} Help`, message.guild.iconURL) + .setThumbnail(bot.user.displayAvatarURL) - if (!args[0]) { - for(let i = 0; i < types.length; i++) { - arr.push(bot.commands.filter(c => c.config.category == types[i].toLowerCase()).map(c => `\`${c.config.name}\``).join(" ")); - try { - embed.addField(types[i], arr[i]); - } catch (e) { - embed.addBlankField(); - } - } + if(!args[0]) { + const categories = readdirSync("./commands/") + + embed.setDescription(`These are the avaliable commands for ${message.guild.me.displayName}\nThe bot prefix is: **${prefix}**`) + embed.setFooter(`© ${message.guild.me.displayName} | Total Commands: ${bot.commands.size}`, bot.user.displayAvatarURL); + + categories.forEach(category => { + const dir = bot.commands.filter(c => c.config.category === category) + const capitalise = category.slice(0, 1).toUpperCase() + category.slice(1) + try { + embed.addField(`❯ ${capitalise} [${dir.size}]:`, dir.map(c => `\`${c.config.name}\``).join(" ")) + } catch(e) { + console.log(e) + } + }) + + return message.channel.send(embed) + } else { + let command = bot.commands.get(bot.aliases.get(args[0].toLowerCase()) || args[0].toLowerCase()) + if(!command) return message.channel.send(embed.setTitle("Invalid Command.").setDescription(`Do \`${prefix}help\` for the list of the commands.`)) + command = command.config + + embed.setDescription(stripIndents`The bot's prefix is: \`${prefix}\`\n + **Command:** ${command.name.slice(0, 1).toUpperCase() + command.name.slice(1)} + **Description:** ${command.description || "No Description provided."} + **Usage:** ${command.usage ? `\`${prefix}${command.name} ${command.usage}\`` : "No Usage"} + **Accessible by:** ${command.accessableby || "Members"} + **Aliases:** ${command.aliases ? command.aliases.join(", ") : "None."}`) - embed.setColor(cyan) - .setAuthor(`${message.guild.me.displayName} Help`, message.guild.iconURL) - .setThumbnail(bot.user.displayAvatarURL) - .setTimestamp() - .setDescription(`These are the avaliable commands for the TestBOT!\nThe bot prefix is: **${prefix}**`) - .setFooter("Test Bot 2k19", bot.user.displayAvatarURL) - message.channel.send(embed) - } else { - let command = bot.commands.get(args[0].toLowerCase()) ? bot.commands.get(args[0].toLowerCase()).config : bot.commands.get(bot.aliases.get(args[0].toLowerCase())).config; - - embed.setColor(cyan) - .setAuthor(`${message.guild.me.displayName} Help`, message.guild.iconURL) - .setThumbnail(bot.user.displayAvatarURL) - .setDescription(`The bot prefix is: ${prefix}\n\n**Command:** ${command.name}\n**Description:** ${command.description || "No Description"}\n**Usage:** ${command.usage || "No Usage"}\n**Accessable by:** ${command.accessableby || "Members"}\n**Aliases:** ${command.aliases ? command.aliases.join(", ") : "None"}`) - message.channel.send(embed); + return message.channel.send(embed) } } -} \ No newline at end of file +} From 95bc670a2fa81957a56365f475d283bad4133ec4 Mon Sep 17 00:00:00 2001 From: Connor Strand <42255832+Strandxo@users.noreply.github.com> Date: Sun, 30 Jun 2019 21:28:11 +0930 Subject: [PATCH 10/31] updated with new API --- commands/miscellaneous/meme.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/commands/miscellaneous/meme.js b/commands/miscellaneous/meme.js index 9ac385e..a2a0325 100644 --- a/commands/miscellaneous/meme.js +++ b/commands/miscellaneous/meme.js @@ -13,14 +13,14 @@ module.exports = { run: async (bot, message, args) => { let msg = await message.channel.send("Generating...") - fetch(`https://api-to.get-a.life/meme`) + fetch("https://apis.duncte123.me/meme") .then(res => res.json()).then(body => { if(!body) return message.reply("whoops! I've broke, try again!") let mEmbed = new RichEmbed() .setColor(cyan) .setAuthor(`${bot.user.username} MEMES!`, message.guild.iconURL) - .setImage(body.url) + .setImage(body.image) .setTimestamp() .setFooter(bot.user.username.toUpperCase(), bot.user.displayAvatarURL) @@ -28,4 +28,4 @@ module.exports = { msg.delete(); }) } -} \ No newline at end of file +} From 455fdc2d4327794da99e5806fae2f0cf6807e189 Mon Sep 17 00:00:00 2001 From: Connor Strand <42255832+Strandxo@users.noreply.github.com> Date: Wed, 3 Jul 2019 22:13:05 +0930 Subject: [PATCH 11/31] Add files via upload --- commands/images/alpaca.js | 31 +++++++++++++++++++++++++++++++ commands/images/cat.js | 31 +++++++++++++++++++++++++++++++ commands/images/dog.js | 31 +++++++++++++++++++++++++++++++ commands/images/llama.js | 30 ++++++++++++++++++++++++++++++ commands/images/meme.js | 33 +++++++++++++++++++++++++++++++++ commands/images/seal.js | 30 ++++++++++++++++++++++++++++++ 6 files changed, 186 insertions(+) create mode 100644 commands/images/alpaca.js create mode 100644 commands/images/cat.js create mode 100644 commands/images/dog.js create mode 100644 commands/images/llama.js create mode 100644 commands/images/meme.js create mode 100644 commands/images/seal.js diff --git a/commands/images/alpaca.js b/commands/images/alpaca.js new file mode 100644 index 0000000..b8b8c59 --- /dev/null +++ b/commands/images/alpaca.js @@ -0,0 +1,31 @@ +const { RichEmbed } = require("discord.js") +const { cyan } = require("../../colours.json"); +const fetch = require('node-fetch'); + +module.exports = { + config: { + name: "alpaca", + description: "sends a picture of a alpaca!", + usage: "", + category: "images", + accessableby: "Members", + aliases: ["catto"] + }, + run: async (bot, message, args) => { + let msg = await message.channel.send("Generating...") + + fetch("https://apis.duncte123.me/alpaca") + .then(res => res.json()).then(body => { + if(!body) return message.reply(" whoops. I broke, try again!") + + let embed = new RichEmbed() + .setColor(cyan) + .setAuthor(`${bot.user.username} Alpaca!`, message.guild.iconURL) + .setImage(body.data.file) + .setTimestamp() + .setFooter(bot.user.username.toUpperCase(), bot.user.displayAvatarURL) + + msg.edit(embed) + }) + } +} \ No newline at end of file diff --git a/commands/images/cat.js b/commands/images/cat.js new file mode 100644 index 0000000..ad6f346 --- /dev/null +++ b/commands/images/cat.js @@ -0,0 +1,31 @@ +const { RichEmbed } = require("discord.js") +const { cyan } = require("../../colours.json"); +const fetch = require('node-fetch'); + +module.exports = { + config: { + name: "cat", + description: "sends a picture of a cat!", + usage: "", + category: "images", + accessableby: "Members", + aliases: ["catto"] + }, + run: async (bot, message, args) => { + let msg = await message.channel.send("Generating...") + + fetch("http://aws.random.cat/meow") + .then(res => res.json()).then(body => { + if(!body) return message.reply(" whoops. I broke, try again!") + + let embed = new RichEmbed() + .setColor(cyan) + .setAuthor(`${bot.user.username} Dogs!`, message.guild.iconURL) + .setImage(body.file) + .setTimestamp() + .setFooter(bot.user.username.toUpperCase(), bot.user.displayAvatarURL) + + msg.edit(embed) + }) + } +} \ No newline at end of file diff --git a/commands/images/dog.js b/commands/images/dog.js new file mode 100644 index 0000000..9a78667 --- /dev/null +++ b/commands/images/dog.js @@ -0,0 +1,31 @@ +const { RichEmbed } = require("discord.js") +const { cyan } = require("../../colours.json"); +const fetch = require('node-fetch'); + +module.exports = { + config: { + name: "dog", + description: "Sends a picture of a dog!", + usage: "", + category: "images", + accessableby: "Members", + aliases: ["doggo", "puppy"] + }, + run: async (bot, message, args) => { + let msg = await message.channel.send("Generating...") + + fetch("https://dog.ceo/api/breeds/image/random") + .then(res => res.json()).then(body => { + if(!body) return message.reply(" whoops. I broke, try again!") + + let embed = new RichEmbed() + .setColor(cyan) + .setAuthor(`${bot.user.username} Dogs!`, message.guild.iconURL) + .setImage(body.message) + .setTimestamp() + .setFooter(bot.user.username.toUpperCase(), bot.user.displayAvatarURL) + + msg.edit(embed) + }) + } +} \ No newline at end of file diff --git a/commands/images/llama.js b/commands/images/llama.js new file mode 100644 index 0000000..5ccfefc --- /dev/null +++ b/commands/images/llama.js @@ -0,0 +1,30 @@ +const { RichEmbed } = require("discord.js") +const { cyan } = require("../../colours.json"); +const fetch = require('node-fetch'); + +module.exports = { + config: { + name: "llama", + description: "Sends a picture of a llama!", + usage: "", + category: "images", + accessableby: "Members", + }, + run: async (bot, message, args) => { + let msg = await message.channel.send("Generating...") + + fetch("https://apis.duncte123.me/llama") + .then(res => res.json()).then(body => { + if(!body) return message.reply(" whoops. I broke, try again!") + + let embed = new RichEmbed() + .setColor(cyan) + .setAuthor(`${bot.user.username} Llama!`, message.guild.iconURL) + .setImage(body.data.file) + .setTimestamp() + .setFooter(bot.user.username.toUpperCase(), bot.user.displayAvatarURL) + + msg.edit(embed) + }) + } +} \ No newline at end of file diff --git a/commands/images/meme.js b/commands/images/meme.js new file mode 100644 index 0000000..b630e5e --- /dev/null +++ b/commands/images/meme.js @@ -0,0 +1,33 @@ +const { RichEmbed } = require("discord.js") +const { cyan } = require("../../colours.json"); +const fetch = require('node-fetch'); + +module.exports = { + config: { + name: "meme", + description: "Sends a meme from a website!", + usage: "", + category: "images", + accessableby: "Members", + }, + run: async (bot, message, args) => { + let msg = await message.channel.send("Generating...") + + fetch("https://apis.duncte123.me/meme") + .then(res => res.json()).then(body => { + if(!body || !body.data.image) return message.reply(" whoops. I broke, try again!") + + let embed = new RichEmbed() + .setColor(cyan) + .setAuthor(`${bot.user.username} meme!`, message.guild.iconURL) + .setImage(body.data.image) + .setTimestamp() + .setFooter(bot.user.username.toUpperCase(), bot.user.displayAvatarURL) + + if(body.data.title) { + embed.setTitle(body.data.title).setURL(body.data.url) + } + msg.edit(embed) + }) + } +} \ No newline at end of file diff --git a/commands/images/seal.js b/commands/images/seal.js new file mode 100644 index 0000000..64f8425 --- /dev/null +++ b/commands/images/seal.js @@ -0,0 +1,30 @@ +const { RichEmbed } = require("discord.js") +const { cyan } = require("../../colours.json"); +const fetch = require('node-fetch'); + +module.exports = { + config: { + name: "seal", + description: "Sends a picture of a seal!", + usage: "", + category: "images", + accessableby: "Members", + }, + run: async (bot, message, args) => { + let msg = await message.channel.send("Generating...") + + fetch("https://apis.duncte123.me/seal") + .then(res => res.json()).then(body => { + if(!body) return message.reply(" whoops. I broke, try again!") + + let embed = new RichEmbed() + .setColor(cyan) + .setAuthor(`${bot.user.username} Seal!`, message.guild.iconURL) + .setImage(body.data.file) + .setTimestamp() + .setFooter(bot.user.username.toUpperCase(), bot.user.displayAvatarURL) + + msg.edit(embed) + }) + } +} \ No newline at end of file From cbe484c2bfc5cc1223a03bbb52bf36ad75ff5e68 Mon Sep 17 00:00:00 2001 From: Connor Strand <42255832+Strandxo@users.noreply.github.com> Date: Sun, 4 Aug 2019 20:51:51 +0930 Subject: [PATCH 12/31] Add files via upload --- commands/miscellaneous/urban.js | 44 +++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 commands/miscellaneous/urban.js diff --git a/commands/miscellaneous/urban.js b/commands/miscellaneous/urban.js new file mode 100644 index 0000000..58ca9f3 --- /dev/null +++ b/commands/miscellaneous/urban.js @@ -0,0 +1,44 @@ +const urban = require("urban"); +const { RichEmbed } = require("discord.js"); +const { cyan } = require("../../colours.json"); +const { stripIndents } = require("common-tags"); + +module.exports = { + config: { + name: "urban", + aliases: ["urb", "urbandictionary", "ud"], + category: "miscellaneous", + description: "gets an urban dictionary definition", + usage: " (query)", + accessableby: "Members" + }, + run: async (bot, message, args) => { + if(!message.channel.nsfw) return message.channel.send("Please run this command in a `NSFW` channel."); + if(args < 1 || !["search", "random"].includes(args[0])) return message.channel.send("`-urban (query)`"); + let image = "http://cdn.marketplaceimages.windowsphone.com/v8/images/5c942bfe-6c90-45b0-8cd7-1f2129c6e319?imageType=ws_icon_medium"; + let search = args[1] ? urban(args.slice(1).join(" ")) : urban.random(); + try { + search.first(res => { + if(!res) return message.channel.send("No results found for this topic, sorry!"); + let { word, definition, example, thumbs_up, thumbs_down, permalink, author} = res; + + let embed = new RichEmbed() + .setColor(cyan) + .setAuthor(`Urban Dictionary | ${word}`, image) + .setThumbnail(image) + .setDescription(stripIndents`**Defintion:** ${definition || "No definition"} + **Example:** ${example || "No Example"} + **Upvote:** ${thumbs_up || 0} + **Downvote:** ${thumbs_down || 0} + **Link:** [link to ${word}](${permalink || "https://www.urbandictionary.com/"})`) + .setTimestamp() + .setFooter(`Written by ${author || "unknown"}`); + + message.channel.send(embed) + }) + } catch(e) { + console.log(e) + return message.channel.send("looks like i've broken! Try again") + } + } +} \ No newline at end of file From 532112c115bf252a4bfda7eda0815540f6d3ef9b Mon Sep 17 00:00:00 2001 From: Connor Strand <42255832+Strandxo@users.noreply.github.com> Date: Sun, 4 Aug 2019 20:52:26 +0930 Subject: [PATCH 13/31] Add files via upload --- commands/miscellaneous/xkcd.js | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 commands/miscellaneous/xkcd.js diff --git a/commands/miscellaneous/xkcd.js b/commands/miscellaneous/xkcd.js new file mode 100644 index 0000000..b1d1549 --- /dev/null +++ b/commands/miscellaneous/xkcd.js @@ -0,0 +1,36 @@ +const { RichEmbed } = require("discord.js"); +const { cyan } = require("../../colours.json"); +const fetch = require("node-fetch"); //npm i node-fetch + +module.exports = { + config: { + name: "xkcd", + description: "xkcd comics, get the latest or certain comic", + usage: " (id)", + category: "miscellaneous", + accessableby: "Members", + }, + run: async (bot, message, args) => { + if(!message.channel.nsfw) return message.channel.send("Please run this command in a `NSFW` channel."); + if((args[1] && isNaN(args[1])) || !["search", "latest"].includes(args[0])) return message.channel.send("`-xkcd (id)"); + let search = args[1] ? `http://xkcd.com/${args[1]}/info.0.json` : "http://xkcd.com/info.0.json"; + try { + fetch(search).then(res => res.json()).then(res => { + if(!res) return message.channel.send("No results found for this comic, sorry!"); + let { safe_title, img, day, month, year, num, alt} = res; + + let embed = new RichEmbed() + .setColor(cyan) + .setDescription(alt ? alt : "*crickets* - No Description") + .setAuthor(`XKCD | ${safe_title} [${num}]`) + .setImage(img) + .setFooter(`Published ${day}/${month}/${year}`) + + message.channel.send(embed) + }) + } catch(e) { + console.log(e) + return message.channel.send("looks like ive broken! Try again.") + } + } +} \ No newline at end of file From e0ecd270843915ede9bbf34cad0e4aefac2c2c62 Mon Sep 17 00:00:00 2001 From: Connor Strand <42255832+Strandxo@users.noreply.github.com> Date: Mon, 19 Aug 2019 22:09:59 +0930 Subject: [PATCH 14/31] Add files via upload --- commands/miscellaneous/steam.js | 53 +++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 commands/miscellaneous/steam.js diff --git a/commands/miscellaneous/steam.js b/commands/miscellaneous/steam.js new file mode 100644 index 0000000..1cbd40e --- /dev/null +++ b/commands/miscellaneous/steam.js @@ -0,0 +1,53 @@ +const { RichEmbed } = require("discord.js"); +const fetch = require("node-fetch"); +const { cyan } = require("../../colours.json"); +const { stripIndents } = require("common-tags"); +const dateFormat = require("dateformat"); + +module.exports = { + config: { + name: "steam", + description: "Get steam statistics of a user", + usage: "", + category: "miscellaneous", + accessableby: "Members" + }, + run: async (bot, message, args) => { + const token = "steamToken"; //I reset mine. + if(!args[0]) return message.channel.send("Please provide an account name!"); + const url = `http://api.steampowered.com/ISteamUser/ResolveVanityURL/v0001/?key=${token}&vanityurl=${args.join(" ")}`; + + fetch(url).then(res => res.json()).then(body => { + if(body.response.success === 42) return message.channel.send("I was unable to find a steam profile with that name"); + + const id = body.response.steamid; + const summaries = `http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=${token}&steamids=${id}`; + const bans = `http://api.steampowered.com/ISteamUser/GetPlayerBans/v1/?key=${token}&steamids=${id}`; + const state = ["Offline", "Online", "Busy", "Away", "Snooze", "Looking to trade", "Looking to play"]; + + fetch(summaries).then(res => res.json()).then(body => { + if(!body.response) return message.channel.send("I was unable to find a steam profile with that name"); + const { personaname, avatarfull, realname, personastate, loccountrycode, profileurl, timecreated } = body.response.players[0]; + + fetch(bans).then(res => res.json()).then(body => { + if(!body.players) return message.channel.send("I was unable to find a steam profile with that name"); + const { NumberOfVACBans, NumberOfGameBans} = body.players[0]; + + const embed = new RichEmbed() + .setColor(cyan) + .setAuthor(`Steam Services | ${personaname}`, avatarfull) + .setThumbnail(avatarfull) + .setDescription(stripIndents`**Real Name:** ${realname || "Unknown"} + **Status:** ${state[personastate]} + **Country:** :flag_${loccountrycode ? loccountrycode.toLowerCase() : "white"}: + **Account Created:** ${dateFormat(timecreated * 1000, "d/mm/yyyy (h:MM:ss TT)")} + **Bans:** Vac: ${NumberOfVACBans}, Game: ${NumberOfGameBans} + **Link:** [link to profile](${profileurl})`) + .setTimestamp(); + + message.channel.send(embed) + }) + }) + }) + } +} \ No newline at end of file From d0b41bec16c7a7349ac38aac686ba10ffdcf4fb9 Mon Sep 17 00:00:00 2001 From: Connor Strand <42255832+Strandxo@users.noreply.github.com> Date: Mon, 23 Sep 2019 08:45:08 +0930 Subject: [PATCH 15/31] Add files via upload --- commands/miscellaneous/fortnite.js | 42 ++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 commands/miscellaneous/fortnite.js diff --git a/commands/miscellaneous/fortnite.js b/commands/miscellaneous/fortnite.js new file mode 100644 index 0000000..7f74775 --- /dev/null +++ b/commands/miscellaneous/fortnite.js @@ -0,0 +1,42 @@ +const { RichEmbed } = require("discord.js"); +const { cyan } = require("../../colours.json"); +const { stripIndents } = require("common-tags"); +const fortnite = require("simple-fortnite-api"), client = new fortnite("75a8798f-dd48-4ccb-9844-32f1055a5d2e"); + +module.exports = { + config: { + name: "fortnite", + description: "Displays a user's fortnite stats!", + usage: " ", + category: "miscellaneous", + accessableby: "Members", + aliases: ["ftn"] + }, + run: async (bot, message, args) => { + if(!args[0]) return message.channel.send("Please supply a username."); + if(args[1] && !["lifetime", "solo", "duo", "squad"].includes(args[1])) return message.channel.send("Usage: `!fortnite `\nGameTypes: Lifetime, Solo, Duo, Squad"); + let gametype = args[1] ? args[1].toLowerCase() : "lifetime"; + + let data = await client.find(args[0]) + if(data && data.code === 404) return message.channel.send("Unable to find a user with that username.") + const { image, url, username } = data; + const { scorePerMin, winPercent, kills, score, wins, kd, matches } = data[gametype] + + const embed = new RichEmbed() + .setColor(cyan) + .setAuthor(`Epic Games (Fortnite) | ${username}`, image) + .setThumbnail(image) + .setDescription(stripIndents`**Gamemode:** ${gametype.slice(0, 1).toUpperCase() + gametype.slice(1)} + **Kills:** ${kills || 0} + **Score:** ${score || 0} + **Score Per Min:** ${scorePerMin || 0} + **Wins:** ${wins || 0} + **Win Ratio:** ${winPercent || "0%"} + **Kill/Death Ratio:** ${kd || 0} + **Matches Played:** ${matches || 0} + **Link:** [link to profile](${url})`) + .setTimestamp() + + message.channel.send(embed) + } +} \ No newline at end of file From fcf47002be6283fed2403a6e2be0ed3daed54f06 Mon Sep 17 00:00:00 2001 From: Connor Strand <42255832+Strandxo@users.noreply.github.com> Date: Thu, 17 Oct 2019 09:21:30 +1030 Subject: [PATCH 16/31] Add files via upload --- commands/miscellaneous/apex.js | 52 ++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 commands/miscellaneous/apex.js diff --git a/commands/miscellaneous/apex.js b/commands/miscellaneous/apex.js new file mode 100644 index 0000000..fb2fc38 --- /dev/null +++ b/commands/miscellaneous/apex.js @@ -0,0 +1,52 @@ +const { RichEmbed } = require("discord.js"); +const { cyan } = require("../../colours.json"); +const { stripIndents } = require("common-tags"); +const API = require("apextab-api"), ApexTab = API.Apextab_API; + +module.exports = { + config: { + name: "apex", + description: "Displays a user's apex stats!", + usage: " ", + category: "miscellaneous", + accessableby: "Members", + aliases: ["apec"] + }, + run: async (bot, message, args) => { + if(!args[0]) return message.channel.send("Please supply a username."); + if(!args[1]) return message.channel.send("Please supply a platform to check. `pc`, `xbox` or `ps4`"); + + const platformCheck = { pc: API.Platform.PC, xbox: API.Platform.XBOX_ONE, ps4: API.Platform.PS4 }; + const platform = platformCheck[args[1].toLowerCase()]; + + try { + const results = await ApexTab.searchPlayer(args[0], platform ? platform : API.Platform.PC) + + for (let playerResult of results.results) { + const player = await ApexTab.getPlayerById(playerResult.aid) + const { name, skillratio, visits, avatar, legend, level, kills, headshots, matches, globalrank, utime } = player; + + const embed = new RichEmbed() + .setColor(cyan) + .setAuthor(`Origin (Apex Legends) | ${name}`, avatar) + .setThumbnail(avatar) + .setDescription(stripIndents` + **Active Legend:** ${legend || "Not Found."} + **Global Rank:** ${globalrank || "Not Ranked."} + **level:** ${level || 0} + **Skill Ratio:** ${skillratio || "0%"} + **Matches:** ${matches || 0} + **Kills:** ${kills || 0} + **Headshots:** ${headshots || 0} + **Visits:** ${visits || 0} + **PlayTime:** ${Math.ceil(utime / (1000 * 60 * 60 * 24)) || 0} days + `) + .setTimestamp() + + message.channel.send(embed) + } + } catch(err) { + return message.channel.send("Can't find a player by that") + } + } +} \ No newline at end of file From 688b8739deb584aab8e8d181cad5ab9bd7421c01 Mon Sep 17 00:00:00 2001 From: Connor Strand <42255832+Strandxo@users.noreply.github.com> Date: Thu, 17 Oct 2019 09:22:07 +1030 Subject: [PATCH 17/31] Add files via upload --- commands/miscellaneous/overwatch.js | 57 +++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 commands/miscellaneous/overwatch.js diff --git a/commands/miscellaneous/overwatch.js b/commands/miscellaneous/overwatch.js new file mode 100644 index 0000000..85e50f7 --- /dev/null +++ b/commands/miscellaneous/overwatch.js @@ -0,0 +1,57 @@ +const { RichEmbed } = require("discord.js"); +const { cyan } = require("../../colours.json"); +const { stripIndents } = require("common-tags"); +const overwatch = require("overwatch-api"); + +module.exports = { + config: { + name: "overwatch", + description: "Displays a user's overwatch stats!", + usage: " ", + category: "miscellaneous", + accessableby: "Members", + aliases: ["ow"] + }, + run: async (bot, message, args) => { + if(!args[0]) return message.channel.send("Please supply a username."); + if(!args[1] || (args[1] && !["pc", "xbl", "psn"].includes(args[1]))) return message.channel.send("Please supply a platform to check. `pc`, `xbox` or `psn`"); + if(args[0].includes("#")) args[0] = args[0].replace(/#/g, "-"); + + overwatch.getProfile(args[1], "global", args[0], (err, json) => { + if (err) return message.channel.send("Unable to find a user with that username."); + const { games, level, portrait, username, playtime: { competitive, quickplay }, private } = json; + const { sportsmanship, shotcaller, teammate } = json.endorsement; + const { won, draw, played, lost, win_rate } = json.games.competitive; + + if(private) return message.channel.send("This users stats are private and cant be seen by anyone."); + + const embed = new RichEmbed() + .setColor(cyan) + .setAuthor(`Blizzard (Overwatch) | ${username}`, portrait) + .setThumbnail(portrait) + .addField("General:", stripIndents` + **Level:** ${level || 0} + **Sportsmanship:** ${sportsmanship.rate || 0} / 100 + **Shotcaller:** ${shotcaller.rate || 0} / 100 + **Teammate:** ${teammate.rate || 0} / 100 + `) + .addField("Competitive:", stripIndents` + **Played:** ${played || 0} + **Won:** ${won || 0} + **Draw:** ${draw || 0} + **Lost:** ${lost || 0} + **Win Rate:** ${win_rate || 0} + **Playtime:** ${competitive || 0} + `, true) + .addField("QuickPlay:", stripIndents` + **Played:** ${games.quickplay.played || "N/A"} + **Won:** ${games.quickplay.won || 0} + **Playtime:** ${quickplay || 0} + `, true) + .setTimestamp(); + + message.channel.send(embed); + + }) + } +} \ No newline at end of file From 2cc65f85441dd742fb673c3bdcfcc17f4a6ed7a9 Mon Sep 17 00:00:00 2001 From: Connor Strand <42255832+Strandxo@users.noreply.github.com> Date: Tue, 19 Nov 2019 11:20:29 +1030 Subject: [PATCH 18/31] Add files via upload --- events/client/ready.js | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/events/client/ready.js b/events/client/ready.js index 63e4453..cca8339 100644 --- a/events/client/ready.js +++ b/events/client/ready.js @@ -1,17 +1,15 @@ -module.exports = async bot => { - console.log(`${bot.user.username} is online`) - // bot.user.setActivity("Hello", {type: "STREAMING", url:"https://twitch.tv/Strandable"}); +const { PlayerManager } = require("discord.js-lavalink"); +const { nodes } = require("../../botconfig.json") - let statuses = [ - `${bot.guilds.size} servers!`, - "!help", - `over ${bot.users.size} users!` - ] +module.exports = bot => { + console.log(`${bot.user.username} is online`); - setInterval(function() { - let status = statuses[Math.floor(Math.random() * statuses.length)]; - bot.user.setActivity(status, {type: "WATCHING"}); + // global.lavalink = new PlayerManager(bot, nodes, { + // user: bot.user.id, + // shards: 0 + // }); - }, 5000) + let activities = [ `${bot.guilds.size} servers!`, `${bot.channels.size} channels!`, `${bot.users.size} users!` ], i = 0; + setInterval(() => bot.user.setActivity(`${bot.prefix}help | ${activities[i++ % activities.length]}`, { type: "WATCHING" }), 15000) -} \ No newline at end of file +}; \ No newline at end of file From 34fdba525aeb3b14f3f8b08a2aa5ee1623f7bd23 Mon Sep 17 00:00:00 2001 From: Connor Strand <42255832+Strandxo@users.noreply.github.com> Date: Mon, 9 Dec 2019 11:55:21 +1030 Subject: [PATCH 19/31] Add files via upload --- commands/miscellaneous/rainbowSix.js | 81 ++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 commands/miscellaneous/rainbowSix.js diff --git a/commands/miscellaneous/rainbowSix.js b/commands/miscellaneous/rainbowSix.js new file mode 100644 index 0000000..b7c0dcf --- /dev/null +++ b/commands/miscellaneous/rainbowSix.js @@ -0,0 +1,81 @@ +const { RichEmbed } = require("discord.js"); +const { cyan } = require("../../colours.json"); +const { rainbow: { email, password } } = require("../../botconfig.json"); +const { stripIndents } = require("common-tags"); +const R6API = require("r6api.js"); +const { getId, getLevel, getRank, getStats } = new R6API(email, password); + +module.exports = { + config: { + name: "r6stats", + description: "Displays the Rainbow Six Siege stats for the player specified.", + usage: " (platform) (region)", + category: "miscellaneous", + accessableby: "Members", + aliases: ["rainbow", "rainbow6"] + }, + run: async (bot, message, args) => { + const platforms = { pc: "UPLAY", xbox: "XBL", ps4: "PSN" }; + const regions = { eu: "emea", na: "ncsa", as: "apac" }; + + let player, platform, region; + + if (!args[0]) return message.reply("please specify a player to search!"); + else player = args[0]; + + args[1] && [ "pc", "xbox", "ps4" ].includes(args[1].toLowerCase()) ? platform = platforms[args[1].toLowerCase()] : platform = platforms["pc"]; + args[2] && [ "eu", "na", "as" ].includes(args[2].toLowerCase()) ? region = regions[args[2].toLowerCase()] : region = regions["eu"]; + + if (platform === "XBL") player = player.replace("_", " "); + + player = await getId(platform, player); + if (!player.length) return message.reply("Couldn't fetch results for that player."); + player = player[0]; + + const playerRank = await getRank(platform, player.id); + const playerStats = await getStats(platform, player.id); + const playerGame = await getLevel(platform, player.id); + + if (!playerRank.length || !playerStats.length || !playerGame.length) return message.channel.send("I was unable to fetch some of the data. Try again!"); + + const { current, max, lastMatch } = playerRank[0].seasons[Object.keys(playerRank[0].seasons)[0]].regions[ region ]; + const { pvp, pve } = playerStats[0]; + const { level, xp } = playerGame[0]; + + platform = Object.keys(platforms).find((key) => platforms[key] === platform).toUpperCase(); + region = Object.keys(regions).find((key) => regions[key] === region).toUpperCase(); + + const embed = new RichEmbed() + .setColor(cyan) + .setAuthor(player.username, bot.user.displayAvatarURL) + .setDescription(`Stats for the **${region}** region on ${platform}.`) + .setThumbnail(current.image) + .addField("General:", stripIndents` + **Level:** ${level} (${xp} xp) + **Rank:** ${current.name} (Max: ${max.name}) + **MMR:** ${current.mmr} + `) + .addField("Statistics:", stripIndents` + **Wins:** ${pvp.general.wins} + **Losses:** ${pvp.general.losses} + **Win/Loss Ratio:** ${(pvp.general.wins / pvp.general.matches * 100).toFixed(2)}% + **Kills:** ${pvp.general.kills} + **Deaths:** ${pvp.general.deaths} + **Kills/Deaths Ratio:** ${(pvp.general.kills / pvp.general.deaths).toFixed(2)} + **Playtime:** ${Math.round(pvp.general.playtime / 3600)} hours + `) + .addField("Terroist Hunt:", stripIndents` + **Wins:** ${pve.general.wins} + **Losses:** ${pve.general.losses} + **Win/Loss Ratio:** ${(pve.general.wins / pve.general.matches * 100).toFixed(2)}% + **Kills:** ${pve.general.kills} + **Deaths:** ${pve.general.deaths} + **Kills/Deaths Ratio:** ${(pve.general.kills / pve.general.deaths).toFixed(2)} + **Playtime:** ${Math.round(pve.general.playtime / 3600)} hours + `) + .setTimestamp() + .setFooter(bot.user.username); + + message.channel.send(embed).catch((e) => message.channel.send(`There was an error: ${e.message}`)); + } +} \ No newline at end of file From 4e1f9b81f12e964b83dc3be7c21abe50623cb873 Mon Sep 17 00:00:00 2001 From: Connor Strand <42255832+Strandxo@users.noreply.github.com> Date: Thu, 19 Dec 2019 00:25:01 +1030 Subject: [PATCH 20/31] play command :) --- commands/music/play.js | 74 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 commands/music/play.js diff --git a/commands/music/play.js b/commands/music/play.js new file mode 100644 index 0000000..0c492c2 --- /dev/null +++ b/commands/music/play.js @@ -0,0 +1,74 @@ +const { Utils } = require("erela.js") +const { RichEmbed } = require("discord.js") + +module.exports = { + config: { + name: "play", + description: "Play a song/playlist or search for a song from youtube", + usage: "", + category: "music", + accessableby: "Member", + aliases: ["p", "pplay"] + }, + run: async (bot, message, args) => { + const { voiceChannel } = message.member; + if (!voiceChannel) return message.channel.send("You need to be in a voice channel to play music."); + + const permissions = voiceChannel.permissionsFor(bot.user); + if (!permissions.has("CONNECT")) return message.channel.send("I cannot connect to your voice channel, make sure I have permission to!"); + if (!permissions.has("SPEAK")) return message.channel.send("I cannot connect to your voice channel, make sure I have permission to!"); + + if (!args[0]) return message.channel.send("Please provide a song name or link to search."); + + const player = bot.music.players.spawn({ + guild: message.guild, + textChannel: message.channel, + voiceChannel + }); + + bot.music.search(args.join(" "), message.author).then(async res => { + switch (res.loadType) { + case "TRACK_LOADED": + player.queue.add(res.tracks[0]); + message.channel.send(`Enqueuing \`${res.tracks[0].title}\` \`${Utils.formatTime(res.tracks[0].duration, true)}\``); + if (!player.playing) player.play() + break; + + case "SEARCH_RESULT": + let index = 1; + const tracks = res.tracks.slice(0, 5); + const embed = new RichEmbed() + .setAuthor("Song Selection.", message.author.displayAvatarURL) + .setDescription(tracks.map(video => `**${index++} -** ${video.title}`)) + .setFooter("Your response time closes within the next 30 seconds. Type 'cancel' to cancel the selection"); + + await message.channel.send(embed); + + const collector = message.channel.createMessageCollector(m => { + return m.author.id === message.author.id && new RegExp(`^([1-5]|cancel)$`, "i").test(m.content) + }, { time: 30000, max: 1}); + + collector.on("collect", m => { + if (/cancel/i.test(m.content)) return collector.stop("cancelled") + + const track = tracks[Number(m.content) - 1]; + player.queue.add(track) + message.channel.send(`Enqueuing \`${track.title}\` \`${Utils.formatTime(track.duration, true)}\``); + if(!player.playing) player.play(); + }); + + collector.on("end", (_, reason) => { + if(["time", "cancelled"].includes(reason)) return message.channel.send("Cancelled selection.") + }); + break; + + case "PLAYLIST_LOADED": + res.playlist.tracks.forEach(track => player.queue.add(track)); + const duration = Utils.formatTime(res.playlist.tracks.reduce((acc, cur) => ({duration: acc.duration + cur.duration})).duration, true); + message.channel.send(`Enqueuing \`${res.playlist.tracks.length}\` \`${duration}\` tracks in playlist \`${res.playlist.info.name}\``); + if(!player.playing) player.play() + break; + } + }).catch(err => message.channel.send(err.message)) + } +} \ No newline at end of file From 98cf0e34e7c6a0cda37825ae795961ec62a6e704 Mon Sep 17 00:00:00 2001 From: Connor Strand <42255832+Strandxo@users.noreply.github.com> Date: Thu, 19 Dec 2019 00:25:30 +1030 Subject: [PATCH 21/31] finna get banned --- events/client/ready.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/events/client/ready.js b/events/client/ready.js index cca8339..c2bb8ca 100644 --- a/events/client/ready.js +++ b/events/client/ready.js @@ -1,13 +1,23 @@ -const { PlayerManager } = require("discord.js-lavalink"); +const { ErelaClient, Utils } = require("erela.js"); const { nodes } = require("../../botconfig.json") module.exports = bot => { console.log(`${bot.user.username} is online`); - // global.lavalink = new PlayerManager(bot, nodes, { - // user: bot.user.id, - // shards: 0 - // }); + bot.music = new ErelaClient(bot, nodes) + .on("nodeError", console.log) + .on("nodeConnect", () => console.log("Successfully created a new Node.")) + .on("queueEnd", player => { + player.textChannel.send("Queue has ended.") + return bot.music.players.destroy(player.guild.id) + }) + .on("trackStart", ({textChannel}, {title, duration}) => textChannel.send(`Now playing: **${title}** \`${Utils.formatTime(duration, true)}\``).then(m => m.delete(15000))); + + bot.levels = new Map() + .set("none", 0.0) + .set("low", 0.10) + .set("medium", 0.15) + .set("high", 0.25); let activities = [ `${bot.guilds.size} servers!`, `${bot.channels.size} channels!`, `${bot.users.size} users!` ], i = 0; setInterval(() => bot.user.setActivity(`${bot.prefix}help | ${activities[i++ % activities.length]}`, { type: "WATCHING" }), 15000) From 06ae5fe6b226ae6bb95da7e74a78ae6a37e43939 Mon Sep 17 00:00:00 2001 From: Connor Moriarty <42255832+Strandxo@users.noreply.github.com> Date: Sat, 11 Jan 2020 17:14:47 +1030 Subject: [PATCH 22/31] Fixing overlooked mistake. --- commands/miscellaneous/urban.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/miscellaneous/urban.js b/commands/miscellaneous/urban.js index 58ca9f3..a37e444 100644 --- a/commands/miscellaneous/urban.js +++ b/commands/miscellaneous/urban.js @@ -14,7 +14,7 @@ module.exports = { }, run: async (bot, message, args) => { if(!message.channel.nsfw) return message.channel.send("Please run this command in a `NSFW` channel."); - if(args < 1 || !["search", "random"].includes(args[0])) return message.channel.send("`-urban (query)`"); + if(!args[0] || !["search", "random"].includes(args[0])) return message.channel.send("`-urban (query)`"); let image = "http://cdn.marketplaceimages.windowsphone.com/v8/images/5c942bfe-6c90-45b0-8cd7-1f2129c6e319?imageType=ws_icon_medium"; let search = args[1] ? urban(args.slice(1).join(" ")) : urban.random(); try { @@ -41,4 +41,4 @@ module.exports = { return message.channel.send("looks like i've broken! Try again") } } -} \ No newline at end of file +} From 2a715cefd068c2a001d2b95d925b529640e97a3a Mon Sep 17 00:00:00 2001 From: Connor Moriarty <42255832+Strandxo@users.noreply.github.com> Date: Sat, 11 Jan 2020 17:19:03 +1030 Subject: [PATCH 23/31] Adding Leave command code. --- commands/music/leave.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 commands/music/leave.js diff --git a/commands/music/leave.js b/commands/music/leave.js new file mode 100644 index 0000000..2a0836a --- /dev/null +++ b/commands/music/leave.js @@ -0,0 +1,19 @@ +module.exports = { + config: { + name: "leave", + aliases: ["lev", "stop"], + description: "Makes the bot leave the voice channel.", + accessableby: "Member", + category: "music", + }, + run: async (bot, message, args) => { + const { voiceChannel } = message.member; + const player = bot.music.players.get(message.guild.id); + + if(voiceChannel && voiceChannel.id !== player.voiceChannel.id) return message.channel.send("You need to be in a voice channel to use the leave command."); + if(!player) return message.channel.send("No song/s currently playing in this guild."); + + bot.music.players.destroy(message.guild.id); + return message.channel.send("Successfully stopped the music.") + } +} \ No newline at end of file From 09d6c5d113b620c2e6662a409c5f0dfa232f3141 Mon Sep 17 00:00:00 2001 From: Connor Moriarty <42255832+Strandxo@users.noreply.github.com> Date: Sat, 11 Jan 2020 17:19:50 +1030 Subject: [PATCH 24/31] Adding NowPlaying command code. --- commands/music/nowplaying.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 commands/music/nowplaying.js diff --git a/commands/music/nowplaying.js b/commands/music/nowplaying.js new file mode 100644 index 0000000..fe4b5af --- /dev/null +++ b/commands/music/nowplaying.js @@ -0,0 +1,27 @@ +const { Utils } = require("erela.js") +const { RichEmbed } = require("discord.js") +const { stripIndents } = require("common-tags") + +module.exports = { + config: { + name: "nowplaying", + aliases: ["np", "now"], + description: "Displays what the bot is currently playing.", + accessableby: "Member", + category: "music", + }, + run: async (bot, message, args) => { + const player = bot.music.players.get(message.guild.id); + if (!player || !player.queue[0]) return message.channel.send("No song/s currently playing within this guild."); + const { title, author, duration, thumbnail } = player.queue[0]; + + const embed = new RichEmbed() + .setAuthor("Current Song Playing.", message.author.displayAvatarURL) + .setThumbnail(thumbnail) + .setDescription(stripIndents` + ${player.playing ? "▶️" : "⏸️"} **${title}** \`${Utils.formatTime(duration, true)}\` by ${author} + `); + + return message.channel.send(embed); + } +} \ No newline at end of file From 27453e1bb824b7c23a68a80f6e726c67dbb678f9 Mon Sep 17 00:00:00 2001 From: Connor Moriarty <42255832+Strandxo@users.noreply.github.com> Date: Thu, 23 Jan 2020 10:19:13 +1030 Subject: [PATCH 25/31] Fixing stuff --- commands/music/leave.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/music/leave.js b/commands/music/leave.js index 2a0836a..1d39ed0 100644 --- a/commands/music/leave.js +++ b/commands/music/leave.js @@ -10,10 +10,10 @@ module.exports = { const { voiceChannel } = message.member; const player = bot.music.players.get(message.guild.id); - if(voiceChannel && voiceChannel.id !== player.voiceChannel.id) return message.channel.send("You need to be in a voice channel to use the leave command."); if(!player) return message.channel.send("No song/s currently playing in this guild."); + if(!voiceChannel || voiceChannel.id !== player.voiceChannel.id) return message.channel.send("You need to be in a voice channel to use the leave command."); bot.music.players.destroy(message.guild.id); return message.channel.send("Successfully stopped the music.") } -} \ No newline at end of file +} From 0e567b15bf780d700bad2d29f58c1b020782eb0d Mon Sep 17 00:00:00 2001 From: Connor Moriarty <42255832+Strandxo@users.noreply.github.com> Date: Wed, 26 Feb 2020 09:01:53 +1030 Subject: [PATCH 26/31] Add files via upload --- commands/music/pause.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 commands/music/pause.js diff --git a/commands/music/pause.js b/commands/music/pause.js new file mode 100644 index 0000000..bd3ddab --- /dev/null +++ b/commands/music/pause.js @@ -0,0 +1,20 @@ +module.exports = { + config: { + name: "pause", + aliases: ["resume"], + description: "Makes the bot pause/resume the music currently playing.", + accessableby: "Member", + category: "music", + }, + run: (bot, message, args) => { + const player = bot.music.players.get(message.guild.id); + if (!player) return message.channel.send("No song/s currently playing in this guild."); + + const { voiceChannel } = message.member; + if (!voiceChannel || voiceChannel.id !== player.voiceChannel.id) return message.channel.send("You need to be in a voice channel to pause music."); + + + player.pause(player.playing); + return message.channel.send(`Player is now ${player.playing ? "resumed" : "paused"}.`); + } +} \ No newline at end of file From 7dac7d744ed1140f2cf206127c55d4daca89f7e0 Mon Sep 17 00:00:00 2001 From: Connor Moriarty <42255832+Strandxo@users.noreply.github.com> Date: Wed, 26 Feb 2020 09:02:24 +1030 Subject: [PATCH 27/31] Add files via upload --- commands/music/volume.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 commands/music/volume.js diff --git a/commands/music/volume.js b/commands/music/volume.js new file mode 100644 index 0000000..4b7592c --- /dev/null +++ b/commands/music/volume.js @@ -0,0 +1,23 @@ +module.exports = { + config: { + name: "volume", + aliases: ["vol", "v"], + description: "Adjusts the volume of the bot.", + accessableby: "Member", + category: "music", + usage: "" + }, + run: async (bot, message, args) => { + const player = bot.music.players.get(message.guild.id); + if (!player) return message.channel.send("No song/s currently playing within this guild."); + + const { voiceChannel } = message.member; + if (!voiceChannel || voiceChannel.id !== player.voiceChannel.id) return message.channel.send("You need to be in a voice channel to adjust the volume."); + + if (!args[0]) return message.channel.send(`Current Volume: ${player.volume}`); + if (Number(args[0]) <= 0 || Number(args[0]) > 100) return message.channel.send("You may only set the volume to 1-100"); + + player.setVolume(Number(args[0])); + return message.channel.send(`Successfully set the volume to: ${args[0]}`) + } +} \ No newline at end of file From 9fd298521704aea9e9f5d76c8ca7e6bbdf57aae7 Mon Sep 17 00:00:00 2001 From: Connor Moriarty <42255832+Strandxo@users.noreply.github.com> Date: Wed, 26 Feb 2020 09:02:59 +1030 Subject: [PATCH 28/31] Add files via upload --- commands/music/skip.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 commands/music/skip.js diff --git a/commands/music/skip.js b/commands/music/skip.js new file mode 100644 index 0000000..f54b1d2 --- /dev/null +++ b/commands/music/skip.js @@ -0,0 +1,20 @@ +module.exports = { + config: { + name: "skip", + aliases: ["next"], + description: "Skips the song currently playing.", + accessableby: "Member", + category: "music", + usage: "" + }, + run: (bot, message, args) => { + const player = bot.music.players.get(message.guild.id); + if(!player) return message.channel.send("No song/s currently playing in this guild."); + + const { voiceChannel } = message.member; + if(!voiceChannel || voiceChannel.id !== player.voiceChannel.id) return message.channel.send("You need to be in a voice channel to use the skip command."); + + player.stop(); + return message.channel.send("Skipped the current song!"); + } +} \ No newline at end of file From ead8a2f6cfcf5d6ac000aab47e2ab250003e77e0 Mon Sep 17 00:00:00 2001 From: Connor Moriarty <42255832+Strandxo@users.noreply.github.com> Date: Wed, 26 Feb 2020 09:03:33 +1030 Subject: [PATCH 29/31] Add files via upload --- commands/music/queue.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 commands/music/queue.js diff --git a/commands/music/queue.js b/commands/music/queue.js new file mode 100644 index 0000000..2004291 --- /dev/null +++ b/commands/music/queue.js @@ -0,0 +1,28 @@ +const { RichEmbed } = require("discord.js") + +module.exports = { + config: { + name: "queue", + aliases: ["q", "now"], + description: "Displays what the current queue is.", + accessableby: "Member", + category: "music", + }, + run: async (bot, message, args) => { + const player = bot.music.players.get(message.guild.id); + if(!player || !player.queue[0]) return message.channel.send("No song currently playing in this guild."); + + let index = 1; + let string = ""; + + if(player.queue[0]) string += `__**Currently Playing**__\n ${player.queue[0].title} - **Requested by ${player.queue[0].requester.username}**. \n`; + if(player.queue[1]) string += `__**Rest of queue:**__\n ${player.queue.slice(1, 10).map(x => `**${index++})** ${x.title} - **Requested by ${x.requester.username}**.`).join("\n")}`; + + const embed = new RichEmbed() + .setAuthor(`Current Queue for ${message.guild.name}`, message.guild.iconURL) + .setThumbnail(player.queue[0].thumbnail) + .setDescription(string); + + return message.channel.send(embed); + } +} \ No newline at end of file From 279b928f39c9f8ee09bdb38b4147dc82304f9443 Mon Sep 17 00:00:00 2001 From: George Date: Tue, 10 Mar 2020 20:51:32 +0000 Subject: [PATCH 30/31] Updated image commands --- .gitignore | 1 + botconfig.json | 7 + commands/images/alpaca.js | 51 ++- commands/images/cat.js | 52 +-- commands/images/dog.js | 52 +-- commands/images/llama.js | 50 +-- commands/images/meme.js | 55 ++- commands/images/seal.js | 50 +-- commands/miscellaneous/cat.js | 32 -- commands/miscellaneous/dog.js | 33 -- commands/owner/eval.js | 65 +-- events/client/ready.js | 44 +- events/guild/message.js | 19 +- handlers/command.js | 24 +- index.js | 6 +- package-lock.json | 796 ++++++++++++++++++++++++++++++++++ package.json | 25 ++ start_bot.bat | 2 +- 18 files changed, 1068 insertions(+), 296 deletions(-) create mode 100644 .gitignore create mode 100644 botconfig.json delete mode 100644 commands/miscellaneous/cat.js delete mode 100644 commands/miscellaneous/dog.js create mode 100644 package-lock.json create mode 100644 package.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..40b878d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules/ \ No newline at end of file diff --git a/botconfig.json b/botconfig.json new file mode 100644 index 0000000..34cfaaa --- /dev/null +++ b/botconfig.json @@ -0,0 +1,7 @@ +{ + "token": "Your token", + "prefix": "-", + "ownerid": "", + + "rainbow": { "email": "", "password": "" } +} diff --git a/commands/images/alpaca.js b/commands/images/alpaca.js index b8b8c59..a1f5bff 100644 --- a/commands/images/alpaca.js +++ b/commands/images/alpaca.js @@ -1,31 +1,30 @@ -const { RichEmbed } = require("discord.js") +const { MessageEmbed } = require("discord.js"); const { cyan } = require("../../colours.json"); -const fetch = require('node-fetch'); +const fetch = require("node-fetch"); -module.exports = { - config: { - name: "alpaca", - description: "sends a picture of a alpaca!", - usage: "", - category: "images", - accessableby: "Members", - aliases: ["catto"] - }, - run: async (bot, message, args) => { - let msg = await message.channel.send("Generating...") +module.exports = { + config: { + name: "alpaca", + description: "Shows a picture of an alpaca.", + category: "images", + accessableby: "Members" + }, + run: async (bot, message, args) => { + const msg = await message.channel.send("Generating..."); - fetch("https://apis.duncte123.me/alpaca") - .then(res => res.json()).then(body => { - if(!body) return message.reply(" whoops. I broke, try again!") + fetch("https://apis.duncte123.me/alpaca") + .then(res => res.json()) + .then(body => { + if (!body) return message.reply("whoops. Request didn't work too well, try again!"); - let embed = new RichEmbed() - .setColor(cyan) - .setAuthor(`${bot.user.username} Alpaca!`, message.guild.iconURL) - .setImage(body.data.file) - .setTimestamp() - .setFooter(bot.user.username.toUpperCase(), bot.user.displayAvatarURL) + const embed = new MessageEmbed() + .setColor(cyan) + .setTitle("Alpaca") + .setImage(body.data.file) + .setTimestamp() + .setFooter(bot.user.username, bot.user.displayAvatarURL()); - msg.edit(embed) - }) - } -} \ No newline at end of file + msg.edit(embed); + }); + } +}; diff --git a/commands/images/cat.js b/commands/images/cat.js index ad6f346..5820653 100644 --- a/commands/images/cat.js +++ b/commands/images/cat.js @@ -1,31 +1,31 @@ -const { RichEmbed } = require("discord.js") +const { MessageEmbed } = require("discord.js"); const { cyan } = require("../../colours.json"); -const fetch = require('node-fetch'); +const fetch = require("node-fetch"); -module.exports = { - config: { - name: "cat", - description: "sends a picture of a cat!", - usage: "", - category: "images", - accessableby: "Members", - aliases: ["catto"] - }, - run: async (bot, message, args) => { - let msg = await message.channel.send("Generating...") +module.exports = { + config: { + name: "cat", + description: "Shows a picture of a cat", + category: "miscellaneous", + accessableby: "Members", + aliases: ["catto"] + }, + run: async (bot, message, args) => { + let msg = await message.channel.send("Generating..."); - fetch("http://aws.random.cat/meow") - .then(res => res.json()).then(body => { - if(!body) return message.reply(" whoops. I broke, try again!") + fetch(`http://aws.random.cat/meow`) + .then(res => res.json()) + .then(body => { + if (!body) return message.reply("whoops. Request didn't work too well, try again!"); - let embed = new RichEmbed() - .setColor(cyan) - .setAuthor(`${bot.user.username} Dogs!`, message.guild.iconURL) - .setImage(body.file) - .setTimestamp() - .setFooter(bot.user.username.toUpperCase(), bot.user.displayAvatarURL) + const embed = new MessageEmbed() + .setColor(cyan) + .setTitle("Cat") + .setImage(body.file) + .setTimestamp() + .setFooter(bot.user.username, bot.user.displayAvatarURL()); - msg.edit(embed) - }) - } -} \ No newline at end of file + msg.edit(embed); + }); + } +}; diff --git a/commands/images/dog.js b/commands/images/dog.js index 9a78667..c6aaef2 100644 --- a/commands/images/dog.js +++ b/commands/images/dog.js @@ -1,31 +1,31 @@ -const { RichEmbed } = require("discord.js") +const { MessageEmbed } = require("discord.js"); const { cyan } = require("../../colours.json"); -const fetch = require('node-fetch'); +const fetch = require("node-fetch"); -module.exports = { - config: { - name: "dog", - description: "Sends a picture of a dog!", - usage: "", - category: "images", - accessableby: "Members", - aliases: ["doggo", "puppy"] - }, - run: async (bot, message, args) => { - let msg = await message.channel.send("Generating...") +module.exports = { + config: { + name: "dog", + description: "Shows a picture of n dog.", + category: "miscellaneous", + accessableby: "Members", + aliases: ["doggo", "puppy"] + }, + run: async (bot, message, args) => { + const msg = await message.channel.send("Generating..."); - fetch("https://dog.ceo/api/breeds/image/random") - .then(res => res.json()).then(body => { - if(!body) return message.reply(" whoops. I broke, try again!") + fetch(`https://dog.ceo/api/breeds/image/random`) + .then(res => res.json()) + .then(body => { + if (!body) return message.reply("whoops. Request didn't work too well, try again!"); - let embed = new RichEmbed() - .setColor(cyan) - .setAuthor(`${bot.user.username} Dogs!`, message.guild.iconURL) - .setImage(body.message) - .setTimestamp() - .setFooter(bot.user.username.toUpperCase(), bot.user.displayAvatarURL) + const embed = new MessageEmbed() + .setColor(cyan) + .setTitle("Dogs") + .setImage(body.message) + .setTimestamp() + .setFooter(bot.user.username, bot.user.displayAvatarURL()); - msg.edit(embed) - }) - } -} \ No newline at end of file + msg.edit(embed); + }); + } +}; diff --git a/commands/images/llama.js b/commands/images/llama.js index 5ccfefc..1f57011 100644 --- a/commands/images/llama.js +++ b/commands/images/llama.js @@ -1,30 +1,30 @@ -const { RichEmbed } = require("discord.js") +const { MessageEmbed } = require("discord.js"); const { cyan } = require("../../colours.json"); -const fetch = require('node-fetch'); +const fetch = require("node-fetch"); -module.exports = { - config: { - name: "llama", - description: "Sends a picture of a llama!", - usage: "", - category: "images", - accessableby: "Members", - }, - run: async (bot, message, args) => { - let msg = await message.channel.send("Generating...") +module.exports = { + config: { + name: "llama", + description: "Shows a picture of a llama.", + category: "images", + accessableby: "Members" + }, + run: async (bot, message, args) => { + const msg = await message.channel.send("Generating..."); - fetch("https://apis.duncte123.me/llama") - .then(res => res.json()).then(body => { - if(!body) return message.reply(" whoops. I broke, try again!") + fetch("https://apis.duncte123.me/llama") + .then(res => res.json()) + .then(body => { + if (!body) return message.reply("whoops. Request didn't work too well, try again!"); - let embed = new RichEmbed() - .setColor(cyan) - .setAuthor(`${bot.user.username} Llama!`, message.guild.iconURL) - .setImage(body.data.file) - .setTimestamp() - .setFooter(bot.user.username.toUpperCase(), bot.user.displayAvatarURL) + const embed = new MessageEmbed() + .setColor(cyan) + .setAuthor("Llama") + .setImage(body.data.file) + .setTimestamp() + .setFooter(bot.user.username, bot.user.displayAvatarURL()); - msg.edit(embed) - }) - } -} \ No newline at end of file + msg.edit(embed); + }); + } +}; diff --git a/commands/images/meme.js b/commands/images/meme.js index b630e5e..b587499 100644 --- a/commands/images/meme.js +++ b/commands/images/meme.js @@ -1,33 +1,32 @@ -const { RichEmbed } = require("discord.js") +const { MessageEmbed } = require("discord.js"); const { cyan } = require("../../colours.json"); -const fetch = require('node-fetch'); +const fetch = require("node-fetch"); -module.exports = { - config: { - name: "meme", - description: "Sends a meme from a website!", - usage: "", - category: "images", - accessableby: "Members", - }, - run: async (bot, message, args) => { - let msg = await message.channel.send("Generating...") +module.exports = { + config: { + name: "meme", + description: "Shows a random meme.", + category: "images", + accessableby: "Members" + }, + run: async (bot, message, args) => { + const msg = await message.channel.send("Generating..."); - fetch("https://apis.duncte123.me/meme") - .then(res => res.json()).then(body => { - if(!body || !body.data.image) return message.reply(" whoops. I broke, try again!") + fetch("https://apis.duncte123.me/meme") + .then(res => res.json()) + .then(body => { + if (!body || !body.data.image) return message.reply("whoops. Request didn't work too well, try again!"); - let embed = new RichEmbed() - .setColor(cyan) - .setAuthor(`${bot.user.username} meme!`, message.guild.iconURL) - .setImage(body.data.image) - .setTimestamp() - .setFooter(bot.user.username.toUpperCase(), bot.user.displayAvatarURL) + const embed = new MessageEmbed() + .setColor(cyan) + .setTitle("Meme") + .setImage(body.data.image) + .setTimestamp() + .setFooter(bot.user.username, bot.user.displayAvatarURL()); - if(body.data.title) { - embed.setTitle(body.data.title).setURL(body.data.url) - } - msg.edit(embed) - }) - } -} \ No newline at end of file + if (body.data.title) embed.setTitle(body.data.title).setURL(body.data.url); + + msg.edit(embed); + }); + } +}; diff --git a/commands/images/seal.js b/commands/images/seal.js index 64f8425..7c2809e 100644 --- a/commands/images/seal.js +++ b/commands/images/seal.js @@ -1,30 +1,30 @@ -const { RichEmbed } = require("discord.js") +const { MessageEmbed } = require("discord.js"); const { cyan } = require("../../colours.json"); -const fetch = require('node-fetch'); +const fetch = require("node-fetch"); -module.exports = { - config: { - name: "seal", - description: "Sends a picture of a seal!", - usage: "", - category: "images", - accessableby: "Members", - }, - run: async (bot, message, args) => { - let msg = await message.channel.send("Generating...") +module.exports = { + config: { + name: "seal", + description: "Shows a picture of a seal.", + category: "images", + accessableby: "Members" + }, + run: async (bot, message, args) => { + const msg = await message.channel.send("Generating..."); - fetch("https://apis.duncte123.me/seal") - .then(res => res.json()).then(body => { - if(!body) return message.reply(" whoops. I broke, try again!") + fetch("https://apis.duncte123.me/seal") + .then(res => res.json()) + .then(body => { + if (!body) return message.reply("whoops. Request didn't work too well, try again!"); - let embed = new RichEmbed() - .setColor(cyan) - .setAuthor(`${bot.user.username} Seal!`, message.guild.iconURL) - .setImage(body.data.file) - .setTimestamp() - .setFooter(bot.user.username.toUpperCase(), bot.user.displayAvatarURL) + let embed = new MessageEmbed() + .setColor(cyan) + .setTitle("Seal") + .setImage(body.data.file) + .setTimestamp() + .setFooter(bot.user.username, bot.user.displayAvatarURL()); - msg.edit(embed) - }) - } -} \ No newline at end of file + msg.edit(embed); + }); + } +}; diff --git a/commands/miscellaneous/cat.js b/commands/miscellaneous/cat.js deleted file mode 100644 index c9955e2..0000000 --- a/commands/miscellaneous/cat.js +++ /dev/null @@ -1,32 +0,0 @@ -const { RichEmbed } = require("discord.js") -const { cyan } = require("../../colours.json"); -const fetch = require('node-fetch'); - -module.exports = { - config: { - name: "cat", - description: "sends a picture of a cat!", - usage: "!cat", - category: "miscellaneous", - accessableby: "Members", - aliases: ["catto"] - }, - run: async (bot, message, args) => { - let msg = await message.channel.send("Generating...") - - fetch(`http://aws.random.cat/meow`) - .then(res => res.json()).then(body => { - if(!body) return message.reply("whoops! I've broke, try again!") - - let cEmbed = new RichEmbed() - .setColor(cyan) - .setAuthor(`${bot.user.username} CATS!`, message.guild.iconURL) - .setImage(body.file) - .setTimestamp() - .setFooter(bot.user.username.toUpperCase(), bot.user.displayAvatarURL) - - message.channel.send(cEmbed) - msg.delete(); - }) - } -} \ No newline at end of file diff --git a/commands/miscellaneous/dog.js b/commands/miscellaneous/dog.js deleted file mode 100644 index 1489884..0000000 --- a/commands/miscellaneous/dog.js +++ /dev/null @@ -1,33 +0,0 @@ -const { RichEmbed } = require("discord.js") -const { cyan } = require("../../colours.json"); -const fetch = require('node-fetch'); - - -module.exports = { - config: { - name: "dog", - description: "Sends a picture of a dog!", - usage: "!dog", - category: "miscellaneous", - accessableby: "Members", - aliases: ["doggo", "puppy"] - }, - run: async (bot, message, args) => { - let msg = await message.channel.send("Generating...") - - fetch(`https://dog.ceo/api/breeds/image/random`) - .then(res => res.json()).then(body => { - if(!body) return message.reply("whoops! I've broke, try again!") - - let dEmbed = new RichEmbed() - .setColor(cyan) - .setAuthor(`${bot.user.username} DOGS!`, message.guild.iconURL) - .setImage(body.message) - .setTimestamp() - .setFooter(bot.user.username.toUpperCase(), bot.user.displayAvatarURL) - - message.channel.send(dEmbed) - msg.delete(); - }) - } -} \ No newline at end of file diff --git a/commands/owner/eval.js b/commands/owner/eval.js index 0e47dca..8fdc55c 100644 --- a/commands/owner/eval.js +++ b/commands/owner/eval.js @@ -1,35 +1,36 @@ const { ownerid, prefix } = require("../../botconfig.json"); -const { inspect } = require("util") +const { inspect } = require("util"); -module.exports = { - config: { - name: "eval", - description: "Evaluates code", - accessableby: "Bot Owner", - type: "owner", - usage: `${prefix}eval ` - }, - run: async (bot, message, args) => { - if(message.author.id == ownerid) { - try { - let toEval = args.join(" ") - let evaluated = inspect(eval(toEval, { depth: 0 })); - - if (!toEval) { - return message.channel.send(`Error while evaluating: \`air\``); - } else { - let hrStart = process.hrtime() - let hrDiff; - hrDiff = process.hrtime(hrStart); - return message.channel.send(`*Executed in ${hrDiff[0] > 0 ? `${hrDiff[0]}s ` : ''}${hrDiff[1] / 1000000}ms.*\n\`\`\`javascript\n${evaluated}\n\`\`\``, { maxLength: 1900 }) - } - - } catch (e) { - return message.channel.send(`Error while evaluating: \`${e.message}\``); - } +module.exports = { + config: { + name: "eval", + description: "Evaluates code", + accessableby: "Bot Owner", + type: "owner", + usage: `${prefix}eval ` + }, + run: async (bot, message, args) => { + if (message.author.id == ownerid) { + try { + let toEval = args.join(" "); + let evaluated = inspect(await eval(toEval, { depth: 0 })); - } else { - return message.reply(" you are not the bot owner!").then(msg => msg.delete(5000)) - } - } -} \ No newline at end of file + if (!toEval) { + return message.channel.send(`Error while evaluating: \`air\``); + } else { + let hrStart = process.hrtime(); + let hrDiff; + hrDiff = process.hrtime(hrStart); + return message.channel.send( + `*Executed in ${hrDiff[0] > 0 ? `${hrDiff[0]}s ` : ""}${hrDiff[1] / + 1000000}ms.*\n\`\`\`javascript\n${evaluated.substring(0, 1900)}\n\`\`\`` + ); + } + } catch (e) { + return message.channel.send(`Error while evaluating: \`${e.message}\``); + } + } else { + return message.reply("you are not the bot owner!").then(msg => msg.delete(5000)); + } + } +}; diff --git a/events/client/ready.js b/events/client/ready.js index c2bb8ca..e24e750 100644 --- a/events/client/ready.js +++ b/events/client/ready.js @@ -1,25 +1,33 @@ const { ErelaClient, Utils } = require("erela.js"); -const { nodes } = require("../../botconfig.json") +const { nodes, prefix } = require("../../botconfig.json"); module.exports = bot => { - console.log(`${bot.user.username} is online`); + console.log(`Logged in as ${bot.user.tag}`); - bot.music = new ErelaClient(bot, nodes) - .on("nodeError", console.log) - .on("nodeConnect", () => console.log("Successfully created a new Node.")) - .on("queueEnd", player => { - player.textChannel.send("Queue has ended.") - return bot.music.players.destroy(player.guild.id) - }) - .on("trackStart", ({textChannel}, {title, duration}) => textChannel.send(`Now playing: **${title}** \`${Utils.formatTime(duration, true)}\``).then(m => m.delete(15000))); + // bot.music = new ErelaClient(bot, nodes) + // .on("nodeError", console.log) + // .on("nodeConnect", () => console.log("Successfully created a new Node.")) + // .on("queueEnd", player => { + // player.textChannel.send("Queue has ended.") + // return bot.music.players.destroy(player.guild.id) + // }) + // .on("trackStart", ({textChannel}, {title, duration}) => textChannel.send(`Now playing: **${title}** \`${Utils.formatTime(duration, true)}\``).then(m => m.delete(15000))); - bot.levels = new Map() - .set("none", 0.0) - .set("low", 0.10) - .set("medium", 0.15) - .set("high", 0.25); + bot.levels = new Map() + .set("none", 0.0) + .set("low", 0.1) + .set("medium", 0.15) + .set("high", 0.25); - let activities = [ `${bot.guilds.size} servers!`, `${bot.channels.size} channels!`, `${bot.users.size} users!` ], i = 0; - setInterval(() => bot.user.setActivity(`${bot.prefix}help | ${activities[i++ % activities.length]}`, { type: "WATCHING" }), 15000) + let activities = [ + `${bot.guilds.cache.size} servers!`, + `${bot.channels.cache.size} channels!`, + `${bot.guilds.cache.reduce((a, b) => a + b.memberCount, 0)} users!` + ], + i = 0; -}; \ No newline at end of file + setInterval( + () => bot.user.setActivity(`${prefix}help | ${activities[i++ % activities.length]}`, { type: "WATCHING" }), + 20000 + ); +}; diff --git a/events/guild/message.js b/events/guild/message.js index 70ccb33..403b41f 100644 --- a/events/guild/message.js +++ b/events/guild/message.js @@ -1,12 +1,13 @@ const { prefix } = require("../../botconfig.json"); -module.exports = async (bot, message) => { - if(message.author.bot || message.channel.type === "dm") return; +module.exports = (bot, message) => { + if (message.author.bot || !message.guild || !message.content.startsWith(prefix)) return; - let args = message.content.slice(prefix.length).trim().split(/ +/g); - let cmd = args.shift().toLowerCase(); - - if(!message.content.startsWith(prefix)) return; - let commandfile = bot.commands.get(cmd) || bot.commands.get(bot.aliases.get(cmd)) - if(commandfile) commandfile.run(bot, message, args) -} \ No newline at end of file + let args = message.content + .slice(prefix.length) + .trim() + .split(/ +/g); + const cmd = args.shift().toLowerCase(); + const commandfile = bot.commands.get(cmd) || bot.commands.get(bot.aliases.get(cmd)); + if (commandfile) commandfile.run(bot, message, args); +}; diff --git a/handlers/command.js b/handlers/command.js index 2fedb68..67b2e2b 100644 --- a/handlers/command.js +++ b/handlers/command.js @@ -1,13 +1,13 @@ -const { readdirSync } = require("fs") +const { readdirSync } = require("fs"); -module.exports = (bot) => { - const load = dirs => { - const commands = readdirSync(`./commands/${dirs}/`).filter(d => d.endsWith('.js')); - for (let file of commands) { - let pull = require(`../commands/${dirs}/${file}`); - bot.commands.set(pull.config.name, pull); - if (pull.config.aliases) pull.config.aliases.forEach(a => bot.aliases.set(a, pull.config.name)); - }; - }; - ["miscellaneous", "moderation", "owner"].forEach(x => load(x)); -}; \ No newline at end of file +module.exports = bot => { + const load = dirs => { + const commands = readdirSync(`./commands/${dirs}/`).filter(d => d.endsWith(".js")); + for (let file of commands) { + let pull = require(`../commands/${dirs}/${file}`); + bot.commands.set(pull.config.name, pull); + if (pull.config.aliases) pull.config.aliases.forEach(a => bot.aliases.set(a, pull.config.name)); + } + }; + ["miscellaneous", "moderation", "owner", "images"].forEach(x => load(x)); +}; diff --git a/index.js b/index.js index 8dacaaf..d29c381 100644 --- a/index.js +++ b/index.js @@ -1,8 +1,8 @@ const { Client, Collection } = require("discord.js"); const { token } = require("./botconfig.json"); -const bot = new Client(); +const bot = new Client({ disableMentions: "all" }); -["aliases", "commands"].forEach(x => bot[x] = new Collection()); +["aliases", "commands"].forEach(x => (bot[x] = new Collection())); ["console", "command", "event"].forEach(x => require(`./handlers/${x}`)(bot)); -bot.login(token); \ No newline at end of file +bot.login(token); diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..44bf06b --- /dev/null +++ b/package-lock.json @@ -0,0 +1,796 @@ +{ + "name": "djs-tutorial-master", + "version": "2.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@discordjs/collection": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.1.5.tgz", + "integrity": "sha512-CU1q0UXQUpFNzNB7gufgoisDHP7n+T3tkqTsp3MNUkVJ5+hS3BCvME8uCXAUFlz+6T2FbTCu75A+yQ7HMKqRKw==" + }, + "@types/node": { + "version": "11.15.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-11.15.7.tgz", + "integrity": "sha512-3c3Kc7VIdE5UpqpmztRy7FU+turZgIurGnwpGFy/fRFOirfPc7ZnoFL83qVoqEDENJENqDhtGyQZ5fkXNQ6Qkw==" + }, + "abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "requires": { + "event-target-shim": "^5.0.0" + } + }, + "ajv": { + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.0.tgz", + "integrity": "sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw==", + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "apextab-api": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/apextab-api/-/apextab-api-1.0.5.tgz", + "integrity": "sha512-as20aD1oW5dQMhRa6qeWZ1thsQwgp4myuAThAGWoVYF7lcwBkTGtg/s7y2J/u09i9Cl1ZQN16rWYoR60rXgsoQ==", + "requires": { + "@types/node": "^11.10.0", + "tsc": "^1.20150623.0", + "typescript": "^3.3.3333" + }, + "dependencies": { + "typescript": { + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz", + "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==" + } + } + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "async": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.0.tgz", + "integrity": "sha512-TR2mEZFVOj2pLStYxLht7TyfuRzaydfpxr3k9RpHIzMgw7A64dzsdqCxH1WJyQdoe8T10nDXd9wnEigmiuHIZw==" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.1.tgz", + "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==" + }, + "axios": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz", + "integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==", + "requires": { + "follow-redirects": "1.5.10" + } + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "requires": { + "tweetnacl": "^0.14.3" + }, + "dependencies": { + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + } + } + }, + "bluebird": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" + }, + "boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=" + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "cheerio": { + "version": "0.22.0", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-0.22.0.tgz", + "integrity": "sha1-qbqoYKP5tZWmuBsahocxIe06Jp4=", + "requires": { + "css-select": "~1.2.0", + "dom-serializer": "~0.1.0", + "entities": "~1.1.1", + "htmlparser2": "^3.9.1", + "lodash.assignin": "^4.0.9", + "lodash.bind": "^4.1.4", + "lodash.defaults": "^4.0.1", + "lodash.filter": "^4.4.0", + "lodash.flatten": "^4.2.0", + "lodash.foreach": "^4.3.0", + "lodash.map": "^4.4.0", + "lodash.merge": "^4.4.0", + "lodash.pick": "^4.2.1", + "lodash.reduce": "^4.4.0", + "lodash.reject": "^4.4.0", + "lodash.some": "^4.4.0" + } + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==" + }, + "common-tags": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/common-tags/-/common-tags-1.8.0.tgz", + "integrity": "sha512-6P6g0uetGpW/sdyUy/iQQCbFF0kWVMSIVSyYz7Zgjcgh8mgw8PQzDNZeyZ5DQ2gM7LBoZPHmnjz8rUthkBG5tw==" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "css-select": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", + "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", + "requires": { + "boolbase": "~1.0.0", + "css-what": "2.1", + "domutils": "1.5.1", + "nth-check": "~1.0.1" + } + }, + "css-what": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.3.tgz", + "integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==" + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "dateformat": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz", + "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==" + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "discord.js": { + "version": "12.0.2", + "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-12.0.2.tgz", + "integrity": "sha512-iZiEA4Y61gqq/EjFfLXnkRK9pLapnax/vTVDUhs/mAhyqozAy0GOlk/MZI9rSa1iIoKTWRq6P9CRKhLNT2wUnA==", + "requires": { + "@discordjs/collection": "^0.1.5", + "abort-controller": "^3.0.0", + "form-data": "^3.0.0", + "node-fetch": "^2.6.0", + "prism-media": "^1.2.0", + "setimmediate": "^1.0.5", + "tweetnacl": "^1.0.3", + "ws": "^7.2.1" + } + }, + "dom-serializer": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz", + "integrity": "sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA==", + "requires": { + "domelementtype": "^1.3.0", + "entities": "^1.1.1" + } + }, + "domelementtype": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", + "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==" + }, + "domhandler": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz", + "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", + "requires": { + "domelementtype": "1" + } + }, + "domutils": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", + "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", + "requires": { + "dom-serializer": "0", + "domelementtype": "1" + } + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "entities": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", + "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==" + }, + "erela.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/erela.js/-/erela.js-1.1.7.tgz", + "integrity": "sha512-SKxFaW5fH4h0Xq0jiD03AnhiyBEODsmBtPOusEjySxgDsFUiXdSFfl4FKDyjDggLG51o3lINf8hfpJvU+J7PLA==", + "requires": { + "axios": "^0.19.2", + "events": "^3.1.0", + "lodash": "^4.17.15", + "util": "^0.12.1", + "ws": "^7.2.1" + } + }, + "event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" + }, + "events": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.1.0.tgz", + "integrity": "sha512-Rv+u8MLHNOdMjTAFeT3nCjHn2aGlx435FP/sDHNaRhDEMwyI/aB22Kj2qIN8R0cw3z28psEQLYwxVKLsKrMgWg==" + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", + "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==" + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "follow-redirects": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", + "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", + "requires": { + "debug": "=3.1.0" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.0.tgz", + "integrity": "sha512-CKMFDglpbMi6PyN+brwB9Q/GOw0eAnsrEZDgcsH5Krhz5Od/haKHAX0NmQfha2zPPz0JpWzA7GJHGSnvCRLWsg==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", + "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", + "requires": { + "ajv": "^6.5.5", + "har-schema": "^2.0.0" + } + }, + "htmlparser2": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", + "integrity": "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==", + "requires": { + "domelementtype": "^1.3.1", + "domhandler": "^2.3.0", + "domutils": "^1.5.1", + "entities": "^1.1.1", + "inherits": "^2.0.1", + "readable-stream": "^3.1.1" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "is-arguments": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.0.4.tgz", + "integrity": "sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA==" + }, + "is-generator-function": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.7.tgz", + "integrity": "sha512-YZc5EwyO4f2kWCax7oegfuSr9mFz1ZvieNYBEjmukLxgXfBUbxAWGVF7GZf0zidYtoBl3WvC07YK0wT76a+Rtw==" + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" + }, + "lodash.assignin": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.assignin/-/lodash.assignin-4.2.0.tgz", + "integrity": "sha1-uo31+4QesKPoBEIysOJjqNxqKKI=" + }, + "lodash.bind": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/lodash.bind/-/lodash.bind-4.2.1.tgz", + "integrity": "sha1-euMBfpOWIqwxt9fX3LGzTbFpDTU=" + }, + "lodash.defaults": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz", + "integrity": "sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw=" + }, + "lodash.filter": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.filter/-/lodash.filter-4.6.0.tgz", + "integrity": "sha1-ZosdSYFgOuHMWm+nYBQ+SAtMSs4=" + }, + "lodash.flatten": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", + "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=" + }, + "lodash.foreach": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.foreach/-/lodash.foreach-4.5.0.tgz", + "integrity": "sha1-Gmo16s5AEoDH8G3d7DUWWrJ+PlM=" + }, + "lodash.map": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.map/-/lodash.map-4.6.0.tgz", + "integrity": "sha1-dx7Hg540c9nEzeKLGTlMNWL09tM=" + }, + "lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" + }, + "lodash.pick": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.pick/-/lodash.pick-4.4.0.tgz", + "integrity": "sha1-UvBWEP/53tQiYRRB7R/BI6AwAbM=" + }, + "lodash.reduce": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.reduce/-/lodash.reduce-4.6.0.tgz", + "integrity": "sha1-8atrg5KZrUj3hKu/R2WW8DuRTTs=" + }, + "lodash.reject": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.reject/-/lodash.reject-4.6.0.tgz", + "integrity": "sha1-gNZJLcFHCGS79YNTO2UfQqn1JBU=" + }, + "lodash.some": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.some/-/lodash.some-4.6.0.tgz", + "integrity": "sha1-G7nzFO9ri63tE7VJFpsqlF62jk0=" + }, + "mime-db": { + "version": "1.43.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz", + "integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==" + }, + "mime-types": { + "version": "2.1.26", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz", + "integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==", + "requires": { + "mime-db": "1.43.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "node-fetch": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", + "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==" + }, + "nth-check": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz", + "integrity": "sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg==", + "requires": { + "boolbase": "~1.0.0" + } + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, + "overwatch-api": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/overwatch-api/-/overwatch-api-0.8.2.tgz", + "integrity": "sha512-DbY7uw8yxk9O8zXI1ngSHV59rfZlk58RuiueLy9O/CPxfihNQNWgHbVEQdRso3XOz+aECgs4As/L6lahn1H9UA==", + "requires": { + "cheerio": "^0.22.0", + "request": "^2.74.0", + "request-promise": "^4.1.1", + "svg-builder": "^1.0.0" + } + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "prism-media": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.2.1.tgz", + "integrity": "sha512-R3EbKwJiYlTvGwcG1DpUt+06DsxOGS5W4AMEHT7oVOjG93MjpdhGX1whHyjnqknylLMupKAsKMEXcTNRbPe6Vw==" + }, + "psl": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.7.0.tgz", + "integrity": "sha512-5NsSEDv8zY70ScRnOTn7bK7eanl2MvFrOrS/R6x+dBt5g1ghnj9Zv90kO8GwT8gxcu2ANyFprnFYB85IogIJOQ==" + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "r6api.js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/r6api.js/-/r6api.js-1.2.1.tgz", + "integrity": "sha512-9Hp8ncfnY4+7Dc44KlUBByPx/GF2ZLniatM5sWmGxYGkxzzujHox9OoW/GmW7WMTMwMnoWMQHsgjpVynHMqUog==", + "requires": { + "bluebird": "^3.5.5", + "node-fetch": "^2.6.0" + } + }, + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "request": { + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "dependencies": { + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + } + } + }, + "request-promise": { + "version": "4.2.5", + "resolved": "https://registry.npmjs.org/request-promise/-/request-promise-4.2.5.tgz", + "integrity": "sha512-ZgnepCykFdmpq86fKGwqntyTiUrHycALuGggpyCZwMvGaZWgxW6yagT0FHkgo5LzYvOaCNvxYwWYIjevSH1EDg==", + "requires": { + "bluebird": "^3.5.0", + "request-promise-core": "1.1.3", + "stealthy-require": "^1.1.1", + "tough-cookie": "^2.3.3" + } + }, + "request-promise-core": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.3.tgz", + "integrity": "sha512-QIs2+ArIGQVp5ZYbWD5ZLCY29D5CfWizP8eWnm8FoGD1TX61veauETVQbrV60662V0oFBkrDOuaBI8XgtuyYAQ==", + "requires": { + "lodash": "^4.17.15" + } + }, + "safe-buffer": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", + "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=" + }, + "simple-fortnite-api": { + "version": "0.1.9", + "resolved": "https://registry.npmjs.org/simple-fortnite-api/-/simple-fortnite-api-0.1.9.tgz", + "integrity": "sha512-UWkS3xCLitO5F5RGTF8xThl19nL35bpNQo8rUAJ5Bve2xXSuszEfGZnIQOA+dgapOqFxlCnJjdKMQqspp/TaAQ==", + "requires": { + "node-fetch": "^2.3.0" + } + }, + "sshpk": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", + "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + }, + "dependencies": { + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + } + } + }, + "stealthy-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", + "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=" + }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "requires": { + "safe-buffer": "~5.2.0" + } + }, + "svg-builder": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/svg-builder/-/svg-builder-1.0.0.tgz", + "integrity": "sha512-Alb20G9MRQLXnc8YhVfimUJdHqQB2KK1/J/0pAlAoRdtD+V8ryoZCNtkDBAGxQuNyd+lX9qb0RKpZ3kso45K+w==" + }, + "tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "requires": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + } + }, + "tsc": { + "version": "1.20150623.0", + "resolved": "https://registry.npmjs.org/tsc/-/tsc-1.20150623.0.tgz", + "integrity": "sha1-Trw8d04WkUjLx2inNCUz8ILHpuU=" + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" + }, + "urban": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/urban/-/urban-0.3.2.tgz", + "integrity": "sha512-B0/cCQNb1XCwHA0YGw1u9IavHMbHe8ruxkUNUlYHobMCAWdk0/gFfOCQQ11CQDmlFu4SUZRoVxrUF3kbE0gdog==", + "requires": { + "commander": ">=0.3.0" + } + }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "requires": { + "punycode": "^2.1.0" + } + }, + "util": { + "version": "0.12.2", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.2.tgz", + "integrity": "sha512-XE+MkWQvglYa+IOfBt5UFG93EmncEMP23UqpgDvVZVFBPxwmkK10QRp6pgU4xICPnWRf/t0zPv4noYSUq9gqUQ==", + "requires": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "safe-buffer": "^5.1.2" + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "ws": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.2.3.tgz", + "integrity": "sha512-HTDl9G9hbkNDk98naoR/cHDws7+EyYMOdL1BmjsZXRUjf7d+MficC4B7HLUPlSiho0vg+CWKrGIt/VJBd1xunQ==" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..8837a66 --- /dev/null +++ b/package.json @@ -0,0 +1,25 @@ +{ + "name": "djs-tutorial-master", + "version": "2.0.0", + "description": "Updated version of the original MenuDocs tutorial series - Discord.js v12", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "start": "node index.js" + }, + "author": "T3NED & Piyush", + "license": "MIT", + "dependencies": { + "apextab-api": "^1.0.5", + "async": "^3.2.0", + "common-tags": "^1.8.0", + "dateformat": "^3.0.3", + "discord.js": "^12.0.2", + "erela.js": "^1.1.7", + "node-fetch": "^2.6.0", + "overwatch-api": "^0.8.2", + "r6api.js": "^1.2.1", + "simple-fortnite-api": "^0.1.9", + "urban": "^0.3.2" + } +} diff --git a/start_bot.bat b/start_bot.bat index c212ea0..0a78308 100644 --- a/start_bot.bat +++ b/start_bot.bat @@ -1,2 +1,2 @@ -nodemon index.js +node index.js PAUSE From acbf4e3b2ea1a477a2e5bea05acc7322b0a3e8bb Mon Sep 17 00:00:00 2001 From: Piyush Bhangale Date: Wed, 11 Mar 2020 16:45:00 +0530 Subject: [PATCH 31/31] update misc commands for v12 --- .gitignore | 6 +++++- commands/miscellaneous/apex.js | 4 ++-- commands/miscellaneous/fortnite.js | 4 ++-- commands/miscellaneous/help.js | 4 ++-- commands/miscellaneous/meme.js | 4 ++-- commands/miscellaneous/overwatch.js | 4 ++-- commands/miscellaneous/rainbowSix.js | 4 ++-- commands/miscellaneous/report.js | 10 +++++----- commands/miscellaneous/serverinfo.js | 8 ++++---- commands/miscellaneous/steam.js | 4 ++-- commands/miscellaneous/urban.js | 4 ++-- commands/miscellaneous/userinfo.js | 10 +++++----- commands/miscellaneous/xkcd.js | 4 ++-- 13 files changed, 37 insertions(+), 33 deletions(-) diff --git a/.gitignore b/.gitignore index 40b878d..a3ef12c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,5 @@ -node_modules/ \ No newline at end of file +node_modules/ +pnpm-lock.yaml + +# until I finish rest +botconfig.json \ No newline at end of file diff --git a/commands/miscellaneous/apex.js b/commands/miscellaneous/apex.js index fb2fc38..f0fa5e5 100644 --- a/commands/miscellaneous/apex.js +++ b/commands/miscellaneous/apex.js @@ -1,4 +1,4 @@ -const { RichEmbed } = require("discord.js"); +const { MessageEmbed } = require("discord.js"); const { cyan } = require("../../colours.json"); const { stripIndents } = require("common-tags"); const API = require("apextab-api"), ApexTab = API.Apextab_API; @@ -26,7 +26,7 @@ module.exports = { const player = await ApexTab.getPlayerById(playerResult.aid) const { name, skillratio, visits, avatar, legend, level, kills, headshots, matches, globalrank, utime } = player; - const embed = new RichEmbed() + const embed = new MessageEmbed() .setColor(cyan) .setAuthor(`Origin (Apex Legends) | ${name}`, avatar) .setThumbnail(avatar) diff --git a/commands/miscellaneous/fortnite.js b/commands/miscellaneous/fortnite.js index 7f74775..9672e60 100644 --- a/commands/miscellaneous/fortnite.js +++ b/commands/miscellaneous/fortnite.js @@ -1,4 +1,4 @@ -const { RichEmbed } = require("discord.js"); +const { MessageEmbed } = require("discord.js"); const { cyan } = require("../../colours.json"); const { stripIndents } = require("common-tags"); const fortnite = require("simple-fortnite-api"), client = new fortnite("75a8798f-dd48-4ccb-9844-32f1055a5d2e"); @@ -22,7 +22,7 @@ module.exports = { const { image, url, username } = data; const { scorePerMin, winPercent, kills, score, wins, kd, matches } = data[gametype] - const embed = new RichEmbed() + const embed = new MessageEmbed() .setColor(cyan) .setAuthor(`Epic Games (Fortnite) | ${username}`, image) .setThumbnail(image) diff --git a/commands/miscellaneous/help.js b/commands/miscellaneous/help.js index 39d44b9..5337bfb 100644 --- a/commands/miscellaneous/help.js +++ b/commands/miscellaneous/help.js @@ -1,4 +1,4 @@ -const { RichEmbed } = require("discord.js"); +const { MessageEmbed } = require("discord.js"); const { prefix } = require("../../botconfig.json"); const { readdirSync } = require("fs") const { stripIndents } = require("common-tags") @@ -14,7 +14,7 @@ module.exports = { accessableby: "Members" }, run: async (bot, message, args) => { - const embed = new RichEmbed() + const embed = new MessageEmbed() .setColor(cyan) .setAuthor(`${message.guild.me.displayName} Help`, message.guild.iconURL) .setThumbnail(bot.user.displayAvatarURL) diff --git a/commands/miscellaneous/meme.js b/commands/miscellaneous/meme.js index a2a0325..6c4773e 100644 --- a/commands/miscellaneous/meme.js +++ b/commands/miscellaneous/meme.js @@ -1,4 +1,4 @@ -const { RichEmbed } = require("discord.js") +const { MessageEmbed } = require("discord.js") const { cyan } = require("../../colours.json"); const fetch = require('node-fetch'); @@ -17,7 +17,7 @@ module.exports = { .then(res => res.json()).then(body => { if(!body) return message.reply("whoops! I've broke, try again!") - let mEmbed = new RichEmbed() + let mEmbed = new MessageEmbed() .setColor(cyan) .setAuthor(`${bot.user.username} MEMES!`, message.guild.iconURL) .setImage(body.image) diff --git a/commands/miscellaneous/overwatch.js b/commands/miscellaneous/overwatch.js index 85e50f7..11aa684 100644 --- a/commands/miscellaneous/overwatch.js +++ b/commands/miscellaneous/overwatch.js @@ -1,4 +1,4 @@ -const { RichEmbed } = require("discord.js"); +const { MessageEmbed } = require("discord.js"); const { cyan } = require("../../colours.json"); const { stripIndents } = require("common-tags"); const overwatch = require("overwatch-api"); @@ -25,7 +25,7 @@ module.exports = { if(private) return message.channel.send("This users stats are private and cant be seen by anyone."); - const embed = new RichEmbed() + const embed = new MessageEmbed() .setColor(cyan) .setAuthor(`Blizzard (Overwatch) | ${username}`, portrait) .setThumbnail(portrait) diff --git a/commands/miscellaneous/rainbowSix.js b/commands/miscellaneous/rainbowSix.js index b7c0dcf..6ed9331 100644 --- a/commands/miscellaneous/rainbowSix.js +++ b/commands/miscellaneous/rainbowSix.js @@ -1,4 +1,4 @@ -const { RichEmbed } = require("discord.js"); +const { MessageEmbed } = require("discord.js"); const { cyan } = require("../../colours.json"); const { rainbow: { email, password } } = require("../../botconfig.json"); const { stripIndents } = require("common-tags"); @@ -45,7 +45,7 @@ module.exports = { platform = Object.keys(platforms).find((key) => platforms[key] === platform).toUpperCase(); region = Object.keys(regions).find((key) => regions[key] === region).toUpperCase(); - const embed = new RichEmbed() + const embed = new MessageEmbed() .setColor(cyan) .setAuthor(player.username, bot.user.displayAvatarURL) .setDescription(`Stats for the **${region}** region on ${platform}.`) diff --git a/commands/miscellaneous/report.js b/commands/miscellaneous/report.js index 9b02224..11deec3 100644 --- a/commands/miscellaneous/report.js +++ b/commands/miscellaneous/report.js @@ -9,19 +9,19 @@ module.exports = { message.delete() // mentioned or grabbed user - let target = message.mentions.members.first() || message.guild.members.get(args[0]) - if(!target) return message.channel.send("Please provide a valid user").then(m => m.delete(15000)) + let target = message.mentions.members.first() || message.guild.members.cache.get(args[0]) + if(!target) return message.channel.send("Please provide a valid user").then(m => m.delete({timeout: 15000})) // reasoning definition let reason = args.slice(1).join(" ") - if(!reason) return message.channel.send(`Please provide a reason for reporting **${target.user.tag}**`).then(m => m.delete(15000)) + if(!reason) return message.channel.send(`Please provide a reason for reporting **${target.user.tag}**`).then(m => m.delete({timeout: 15000})) // grab reports channel - let sChannel = message.guild.channels.find(x => x.name === "tut-reports") + let sChannel = message.guild.channels.cache.find(x => x.name === "tut-reports") // send to reports channel and add tick or cross - message.channel.send("Your report has been filed to the staff team. Thank you!").then(m => m.delete(15000)) + message.channel.send("Your report has been filed to the staff team. Thank you!").then(m => m.delete({timeout: 15000})) sChannel.send(`**${message.author.tag}** has reported **${target.user.tag}** for **${reason}**.`).then(async msg => { await msg.react("✅") await msg.react("❌") diff --git a/commands/miscellaneous/serverinfo.js b/commands/miscellaneous/serverinfo.js index dd8984c..17ff58b 100644 --- a/commands/miscellaneous/serverinfo.js +++ b/commands/miscellaneous/serverinfo.js @@ -1,4 +1,4 @@ -const { RichEmbed } = require("discord.js") +const { MessageEmbed } = require("discord.js") const { cyan } = require("../../colours.json"); module.exports = { @@ -11,15 +11,15 @@ module.exports = { aliases: ["si", "serverdesc"] }, run: async (bot, message, args) => { - let sEmbed = new RichEmbed() + let sEmbed = new MessageEmbed() .setColor(cyan) .setTitle("Server Info") - .setThumbnail(message.guild.iconURL) + .setThumbnail(message.guild.iconURL()) .setAuthor(`${message.guild.name} Info`, message.guild.iconURL) .addField("**Guild Name:**", `${message.guild.name}`, true) .addField("**Guild Owner:**", `${message.guild.owner}`, true) .addField("**Member Count:**", `${message.guild.memberCount}`, true) - .addField("**Role Count:**", `${message.guild.roles.size}`, true) + .addField("**Role Count:**", `${message.guild.roles.cache.size}`, true) .setFooter(`TestBot | Footer`, bot.user.displayAvatarURL); message.channel.send(sEmbed); } diff --git a/commands/miscellaneous/steam.js b/commands/miscellaneous/steam.js index 1cbd40e..cbe50a4 100644 --- a/commands/miscellaneous/steam.js +++ b/commands/miscellaneous/steam.js @@ -1,4 +1,4 @@ -const { RichEmbed } = require("discord.js"); +const { MessageEmbed } = require("discord.js"); const fetch = require("node-fetch"); const { cyan } = require("../../colours.json"); const { stripIndents } = require("common-tags"); @@ -33,7 +33,7 @@ module.exports = { if(!body.players) return message.channel.send("I was unable to find a steam profile with that name"); const { NumberOfVACBans, NumberOfGameBans} = body.players[0]; - const embed = new RichEmbed() + const embed = new MessageEmbed() .setColor(cyan) .setAuthor(`Steam Services | ${personaname}`, avatarfull) .setThumbnail(avatarfull) diff --git a/commands/miscellaneous/urban.js b/commands/miscellaneous/urban.js index a37e444..3c5c320 100644 --- a/commands/miscellaneous/urban.js +++ b/commands/miscellaneous/urban.js @@ -1,5 +1,5 @@ const urban = require("urban"); -const { RichEmbed } = require("discord.js"); +const { MessageEmbed } = require("discord.js"); const { cyan } = require("../../colours.json"); const { stripIndents } = require("common-tags"); @@ -22,7 +22,7 @@ module.exports = { if(!res) return message.channel.send("No results found for this topic, sorry!"); let { word, definition, example, thumbs_up, thumbs_down, permalink, author} = res; - let embed = new RichEmbed() + let embed = new MessageEmbed() .setColor(cyan) .setAuthor(`Urban Dictionary | ${word}`, image) .setThumbnail(image) diff --git a/commands/miscellaneous/userinfo.js b/commands/miscellaneous/userinfo.js index 7792b1f..28f05aa 100644 --- a/commands/miscellaneous/userinfo.js +++ b/commands/miscellaneous/userinfo.js @@ -1,4 +1,4 @@ -const { RichEmbed } = require("discord.js") +const { MessageEmbed } = require("discord.js") const { red_light } = require("../../colours.json"); module.exports = { @@ -11,17 +11,17 @@ module.exports = { aliases: ["ui"] }, run: async (bot, message, args) => { - let uEmbed = new RichEmbed() + let uEmbed = new MessageEmbed() .setColor(red_light) .setTitle("User Info") - .setThumbnail(message.guild.iconURL) - .setAuthor(`${message.author.username} Info`, message.author.displayAvatarURL) + .setThumbnail(message.guild.iconURL()) + .setAuthor(`${message.author.username} Info`, message.author.displayAvatarURL()) .addField("**Username:**", `${message.author.username}`, true) .addField("**Discriminator:**", `${message.author.discriminator}`, true) .addField("**ID:**", `${message.author.id}`, true) .addField("**Status:**", `${message.author.presence.status}`, true) .addField("**Created At:**", `${message.author.createdAt}`, true) - .setFooter(`TestBot | Footer`, bot.user.displayAvatarURL); + .setFooter(`TestBot | Footer`, bot.user.displayAvatarURL()); message.channel.send(uEmbed); } diff --git a/commands/miscellaneous/xkcd.js b/commands/miscellaneous/xkcd.js index b1d1549..5c2d58a 100644 --- a/commands/miscellaneous/xkcd.js +++ b/commands/miscellaneous/xkcd.js @@ -1,4 +1,4 @@ -const { RichEmbed } = require("discord.js"); +const { MessageEmbed } = require("discord.js"); const { cyan } = require("../../colours.json"); const fetch = require("node-fetch"); //npm i node-fetch @@ -19,7 +19,7 @@ module.exports = { if(!res) return message.channel.send("No results found for this comic, sorry!"); let { safe_title, img, day, month, year, num, alt} = res; - let embed = new RichEmbed() + let embed = new MessageEmbed() .setColor(cyan) .setDescription(alt ? alt : "*crickets* - No Description") .setAuthor(`XKCD | ${safe_title} [${num}]`)