mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-12 08:14:47 +02:00
HTTP Dog
This commit is contained in:
@@ -15,7 +15,7 @@ You can invite the bot to your server using
|
||||
Be sure to also join the [home server](https://discord.gg/sbMe32W) for
|
||||
information and support.
|
||||
|
||||
## Commands (302)
|
||||
## Commands (303)
|
||||
### Utility:
|
||||
|
||||
* **prefix**: Shows or sets the command prefix.
|
||||
@@ -136,6 +136,7 @@ information and support.
|
||||
* **google**: Searches Google for your query.
|
||||
* **gravatar**: Responds with the Gravatar for an email.
|
||||
* **http-cat**: Responds with a cat for an HTTP status code.
|
||||
* **http-dog**: Responds with a dog for an HTTP status code.
|
||||
* **imgur**: Searches Imgur for your query.
|
||||
* **itunes**: Searches iTunes for your query.
|
||||
* **jisho**: Defines a word, but with Japanese.
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const request = require('node-superfetch');
|
||||
|
||||
module.exports = class HttpDogCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'http-dog',
|
||||
group: 'search',
|
||||
memberName: 'http-dog',
|
||||
description: 'Responds with a dog for an HTTP status code.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
args: [
|
||||
{
|
||||
key: 'code',
|
||||
prompt: 'What code do you want to get the dog of?',
|
||||
type: 'integer'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { code }) {
|
||||
try {
|
||||
const { body, headers } = await request.get(`https://httpstatusdogs.com/img/${code}.jpg`);
|
||||
if (headers['content-type'].includes('text/html')) return msg.say('Could not find any results.');
|
||||
return msg.say({ files: [{ attachment: body, name: `${code}.jpg` }] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "80.0.0",
|
||||
"version": "80.1.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user