mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-20 21:44:48 +02:00
Read QR Code, Hold Hands
This commit is contained in:
@@ -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!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -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: [
|
||||
{
|
||||
@@ -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!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user