diff --git a/README.md b/README.md index 87b562c3..f9e9b478 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,11 @@ Xiao is a Discord bot coded in JavaScript with [discord.js](https://discord.js.org/) using the -[Commando](https://github.com/discordjs/Commando) command framework. With nearly +[Commando](https://github.com/discordjs/Commando) command framework. With over 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 (299) +## Commands (301) ### Utility: * **prefix**: Shows or sets the command prefix. @@ -178,6 +178,7 @@ served over 10,000 servers with a uniquely devoted fanbase. * **coolness**: Determines a user's coolness. * **face-analyze**: Determines the age, gender, and race of a face. * **gender-analyze**: Determines the gender of a name. +* **read-qr-code**: Reads a QR Code. * **severe-toxicity**: Determines the toxicity of text, but less sensitive to milder language. * **toxicity**: Determines the toxicity of text. @@ -221,6 +222,7 @@ served over 10,000 servers with a uniquely devoted fanbase. * **be-like-bill**: Sends a "Be Like Bill" meme with the name of your choice. * **color**: Sends an image of the color you choose. * **contrast**: Draws an image or a user's avatar but with contrast. +* **create-qr-code**: Converts text to a QR Code. * **demotivational-poster**: Draws an image or a user's avatar and the text you specify as a demotivational poster. * **distort**: Draws an image or a user's avatar but distorted. * **frame**: Draws a frame around an image or a user's avatar. @@ -290,7 +292,6 @@ served over 10,000 servers with a uniquely devoted fanbase. * **owo**: OwO. * **pig-latin**: Converts text to pig latin. * **pirate**: Converts text to pirate. -* **qr-code**: Converts text to a QR Code. * **repeat**: Repeat text over and over and over and over (etc). * **reverse**: Reverses text. * **say**: Make XiaoBot say what you wish. @@ -351,6 +352,7 @@ served over 10,000 servers with a uniquely devoted fanbase. * **fist-bump**: Fistbumps a user. * **high-five**: High Fives a user. * **hit-with-shovel**: Hits a user with a shovel. +* **hold-hands**: Holds hands with a user. * **hug**: Hugs a user. * **inhale**: Inhales a user. * **kill**: Kills a user. diff --git a/commands/analyze/read-qr-code.js b/commands/analyze/read-qr-code.js new file mode 100644 index 00000000..dd0b1818 --- /dev/null +++ b/commands/analyze/read-qr-code.js @@ -0,0 +1,35 @@ +const { Command } = require('discord.js-commando'); +const snekfetch = require('snekfetch'); +const { shorten } = require('../../util/Util'); + +module.exports = class ReadQRCodeCommand extends Command { + constructor(client) { + super(client, { + name: 'read-qr-code', + aliases: ['scan-qr-code', 'scan-qr'], + group: 'analyze', + memberName: 'read-qr-code', + description: 'Reads a QR Code.', + args: [ + { + key: 'image', + prompt: 'What QR Code would you like to read?', + type: 'image' + } + ] + }); + } + + async run(msg, { image }) { + try { + const { body } = await snekfetch + .get('https://api.qrserver.com/v1/read-qr-code/') + .query({ fileurl: image }); + const data = body[0].symbol[0]; + if (!data.data) return msg.reply(`Could not read QR Code: ${data.error}.`); + return msg.reply(shorten(data.data, 2000 - (msg.author.toString().length + 2))); + } catch (err) { + return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); + } + } +}; diff --git a/commands/text-edit/qr-code.js b/commands/image-edit/create-qr-code.js similarity index 79% rename from commands/text-edit/qr-code.js rename to commands/image-edit/create-qr-code.js index d7631c9c..91a4d65c 100644 --- a/commands/text-edit/qr-code.js +++ b/commands/image-edit/create-qr-code.js @@ -1,12 +1,13 @@ const { Command } = require('discord.js-commando'); const snekfetch = require('snekfetch'); -module.exports = class QRCodeCommand extends Command { +module.exports = class CreateQRCodeCommand extends Command { constructor(client) { super(client, { - name: 'qr-code', - group: 'text-edit', - memberName: 'qr-code', + name: 'create-qr-code', + aliases: ['create-qr'], + group: 'image-edit', + memberName: 'create-qr-code', description: 'Converts text to a QR Code.', args: [ { diff --git a/commands/roleplay/hold-hands.js b/commands/roleplay/hold-hands.js new file mode 100644 index 00000000..bc756dd6 --- /dev/null +++ b/commands/roleplay/hold-hands.js @@ -0,0 +1,30 @@ +const { Command } = require('discord.js-commando'); +const { randomFromImgurAlbum } = require('../../util/Util'); + +module.exports = class HoldHandsCommand extends Command { + constructor(client) { + super(client, { + name: 'hold-hands', + aliases: ['hold-hand'], + group: 'roleplay', + memberName: 'hold-hands', + description: 'Holds hands with a user.', + args: [ + { + key: 'user', + prompt: 'What user do you want to roleplay with?', + type: 'user' + } + ] + }); + } + + async run(msg, { user }) { + try { + const gif = await randomFromImgurAlbum('K67Lp'); + return msg.say(`_**${msg.author.username}** holds **${user.username}**'s hand._`, { files: [gif] }); + } catch (err) { + return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); + } + } +}; diff --git a/package.json b/package.json index 38c1c628..36b72293 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "70.5.0", + "version": "71.0.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {