mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-21 05:54:33 +02:00
Beep
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
const Command = require('../../structures/Command');
|
const Command = require('../../structures/Command');
|
||||||
|
const snekfetch = require('snekfetch');
|
||||||
|
|
||||||
module.exports = class RobohashCommand extends Command {
|
module.exports = class RobohashCommand extends Command {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
@@ -19,7 +20,13 @@ module.exports = class RobohashCommand extends Command {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
run(msg, { text }) {
|
async run(msg, { text }) {
|
||||||
return msg.say({ files: [`https://robohash.org/${text}`] });
|
try {
|
||||||
|
const { body } = await snekfetch
|
||||||
|
.get(`https://robohash.org/${text}`);
|
||||||
|
return msg.say({ files: [{ attachment: body, name: 'robohash.png' }] });
|
||||||
|
} catch (err) {
|
||||||
|
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user