diff --git a/commands/text-edit/qr-code.js b/commands/text-edit/qr-code.js new file mode 100644 index 00000000..96a98444 --- /dev/null +++ b/commands/text-edit/qr-code.js @@ -0,0 +1,34 @@ +const { Command } = require('discord.js-commando'); +const snekfetch = require('snekfetch'); + +module.exports = class QRCodeCommand extends Command { + constructor(client) { + super(client, { + name: 'qr-code', + group: 'text-edit', + memberName: 'qr-code', + description: 'Converts text to a QR Code.', + args: [ + { + key: 'text', + prompt: 'What text would you like to convert to a QR Code?', + type: 'string' + } + ] + }); + } + + async run(msg, { text }) { + try { + const { body } = await snekfetch + .get('https://api.qrserver.com/v1/create-qr-code/') + .query({ + data: text, + size: '500x500' + }); + return msg.say({ files: [{ attachment: body, name: 'qr-code.png' }] }); + } catch (err) { + return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); + } + } +}; diff --git a/package.json b/package.json index 10ee9a35..b503b237 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "57.2.0", + "version": "57.3.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {