mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-07 06:45:31 +02:00
QR Code Command
This commit is contained in:
@@ -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
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "57.2.0",
|
||||
"version": "57.3.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user