QR Code Command

This commit is contained in:
Daniel Odendahl Jr
2017-12-13 18:56:47 +00:00
parent 1374ed3112
commit e815395bae
2 changed files with 35 additions and 1 deletions
+34
View File
@@ -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!`);
}
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "57.2.0",
"version": "57.3.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {