diff --git a/README.md b/README.md index 7075ee08..6755a219 100644 --- a/README.md +++ b/README.md @@ -8,16 +8,18 @@ Xiao is a Discord bot coded in JavaScript with 300 commands, she is one of the most feature-filled bots out there, and formerly served over 10,000 servers with a uniquely devoted fanbase. -## Commands (291) +## Commands (293) ### Utility: * **prefix**: Shows or sets the command prefix. * **eval**: Executes JavaScript code. +* **blacklist**: Blacklists a user from using commands. * **donate**: Responds with Xiao's donation links. * **help**: Displays a list of available commands, or detailed information for a specific command. * **info**: Responds with detailed bot information. * **ping**: Checks the bot's ping to the Discord server. * **uptime**: Responds with how long the bot has been active. +* **whitelist**: Removes a user from the blacklist. ### Command Management: diff --git a/assets/json/coolness.json b/assets/json/coolness.json new file mode 100644 index 00000000..08ed1972 --- /dev/null +++ b/assets/json/coolness.json @@ -0,0 +1,12 @@ +[ + "is the coolest being to walk this Earth.", + "is extremely amazingly amazing.", + "is as cool as ice.", + "is an extremely cool dude.", + "is pretty sweet, not gonna lie.", + "is okay, nothing special.", + "is just not all that neat.", + "is awful, honestly.", + "is terrible in every way.", + "smells like a sack of diapers." +] diff --git a/commands/analyze/coolness.js b/commands/analyze/coolness.js index a2e0438a..4eeabc86 100644 --- a/commands/analyze/coolness.js +++ b/commands/analyze/coolness.js @@ -1,4 +1,5 @@ const { Command } = require('discord.js-commando'); +const levels = require('../../assets/json/coolness'); module.exports = class CoolnessCommand extends Command { constructor(client) { @@ -19,16 +20,14 @@ module.exports = class CoolnessCommand extends Command { } run(msg, { user }) { - const coolness = user.id / this.client.user.id; - if (coolness < 0.2) return msg.say(`${user.username} is the coolest being to walk this Earth.`); - if (coolness < 0.4) return msg.say(`${user.username} is extremely amazingly amazing.`); - if (coolness < 0.6) return msg.say(`${user.username} is as cool as ice.`); - if (coolness < 0.8) return msg.say(`${user.username} is an extremely cool dude.`); - if (coolness < 1) return msg.say(`${user.username} is pretty sweet, not gonna lie.`); - if (coolness < 1.2) return msg.say(`${user.username} is okay, nothing special.`); - if (coolness < 1.4) return msg.say(`${user.username} is just not all that neat.`); - if (coolness < 1.6) return msg.say(`${user.username} is awful, honestly.`); - if (coolness < 1.8) return msg.say(`${user.username} smells like a sack of diapers.`); - return msg.say(`${user.username} is terrible in every way.`); + const coolness = Math.round(((user.id / this.client.user.id) * 10) / 2); + if (user.id === this.client.user.id) return msg.say('Me? I think I\'m the very best, like no one ever was.'); + if (this.client.isOwner(user)) { + if (this.client.isOwner(msg.author)) { + return msg.say(`${user.username}, you're the best owner a bot could ask for! ❤`); + } + return msg.say(`Don't tell them I said this but I think ${user.username} ${levels[levels.length - 1]}`); + } + return msg.say(`${user.username} ${levels[Math.min(coolness, levels.length - 1)]}`); } }; diff --git a/commands/image-edit/illegal.js b/commands/image-edit/illegal.js index 7b647f8a..d3e363ac 100644 --- a/commands/image-edit/illegal.js +++ b/commands/image-edit/illegal.js @@ -28,22 +28,21 @@ module.exports = class IllegalCommand extends Command { parse: text => text.toUpperCase() }, { - key: 'isOrAre', - label: 'is or are', - prompt: 'Should the text use is or are?', + key: 'verb', + prompt: 'Should the text use is, are, or am?', type: 'string', default: 'IS', - validate: isOrAre => { - if (['is', 'are'].includes(isOrAre.toLowerCase())) return true; - return 'Invalid is or are, please enter either is or are.'; + validate: verb => { + if (['is', 'are', 'am'].includes(verb.toLowerCase())) return true; + return 'Invalid verb, please enter either is, are, or am.'; }, - parse: isOrAre => isOrAre.toUpperCase() + parse: verb => verb.toUpperCase() } ] }); } - async run(msg, { text, isOrAre }) { + async run(msg, { text, verb }) { const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'illegal.png')); const canvas = createCanvas(base.width, base.height); const ctx = canvas.getContext('2d'); @@ -52,7 +51,7 @@ module.exports = class IllegalCommand extends Command { ctx.font = '45px Noto'; ctx.fillText(stripIndents` ${shortenText(ctx, text, 200)} - ${isOrAre} NOW + ${verb} NOW ILLEGAL. `, 750, 290); return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'illegal.png' }] }); diff --git a/commands/util/blacklist.js b/commands/util/blacklist.js new file mode 100644 index 00000000..8e006777 --- /dev/null +++ b/commands/util/blacklist.js @@ -0,0 +1,31 @@ +const { Command } = require('discord.js-commando'); + +module.exports = class BlacklistCommand extends Command { + constructor(client) { + super(client, { + name: 'blacklist', + aliases: ['blacklist-add'], + group: 'util', + memberName: 'blacklist', + description: 'Blacklists a user from using commands.', + ownerOnly: true, + args: [ + { + key: 'user', + prompt: 'What user do you want to blacklist?', + type: 'user' + } + ] + }); + } + + run(msg, { user }) { + if (this.client.isOwner(msg.author)) return msg.reply('The bot owner cannot be blacklisted.'); + if (user.bot) return msg.reply('Bots cannot be blacklisted.'); + const blacklist = this.client.provider.get('global', 'blacklist', []); + if (blacklist.includes(user.id)) return msg.reply(`${user.tag} is already blacklisted!`); + blacklist.push(blacklist.id); + this.client.provider.set('global', 'blacklist', blacklist); + return msg.say(`${user.tag} has been blacklisted.`); + } +}; diff --git a/commands/util/whitelist.js b/commands/util/whitelist.js new file mode 100644 index 00000000..157e0fac --- /dev/null +++ b/commands/util/whitelist.js @@ -0,0 +1,32 @@ +const { Command } = require('discord.js-commando'); + +module.exports = class WhitelistCommand extends Command { + constructor(client) { + super(client, { + name: 'whitelist', + aliases: ['blacklist-remove', 'blacklist-delete'], + group: 'util', + memberName: 'whitelist', + description: 'Removes a user from the blacklist.', + ownerOnly: true, + args: [ + { + key: 'user', + prompt: 'What user do you want to whitelist?', + type: 'user' + } + ] + }); + } + + run(msg, { user }) { + if (this.client.isOwner(msg.author)) return msg.reply('The bot owner cannot be blacklisted.'); + if (user.bot) return msg.reply('Bots cannot be blacklisted.'); + const blacklist = this.client.provider.get('global', 'blacklist', []); + if (!blacklist.includes(user.id)) return msg.reply(`${user.tag} is not blacklisted!`); + blacklist.splice(blacklist.indexOf(user.id), 1); + if (!blacklist.length) this.client.provider.remove('global', 'blacklist'); + else this.client.provider.set('global', 'blacklist', blacklist); + return msg.say(`${user.tag} has been whitelisted.`); + } +}; diff --git a/package.json b/package.json index 70f63db2..f5c35e5e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "69.3.1", + "version": "69.4.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {