mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-23 18:05:01 +02:00
HTTP Duck Command
This commit is contained in:
@@ -91,7 +91,7 @@ Xiao is a Discord bot coded in JavaScript with
|
|||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
Total: 353
|
Total: 354
|
||||||
|
|
||||||
### Utility:
|
### Utility:
|
||||||
|
|
||||||
@@ -236,6 +236,7 @@ Total: 353
|
|||||||
* **gravatar:** Responds with the Gravatar for an email.
|
* **gravatar:** Responds with the Gravatar for an email.
|
||||||
* **http-cat:** Responds with a cat for an HTTP status code.
|
* **http-cat:** Responds with a cat for an HTTP status code.
|
||||||
* **http-dog:** Responds with a dog for an HTTP status code.
|
* **http-dog:** Responds with a dog for an HTTP status code.
|
||||||
|
* **http-duck:** Responds with a duck for an HTTP status code.
|
||||||
* **imgur:** Searches Imgur for your query.
|
* **imgur:** Searches Imgur for your query.
|
||||||
* **itunes:** Searches iTunes for your query.
|
* **itunes:** Searches iTunes for your query.
|
||||||
* **jisho:** Defines a word, but with Japanese.
|
* **jisho:** Defines a word, but with Japanese.
|
||||||
@@ -847,6 +848,7 @@ here.
|
|||||||
* shower-thought (Shower Thought Data)
|
* shower-thought (Shower Thought Data)
|
||||||
- [Random-d.uk](https://random-d.uk/)
|
- [Random-d.uk](https://random-d.uk/)
|
||||||
* duck ([API](https://random-d.uk/api))
|
* duck ([API](https://random-d.uk/api))
|
||||||
|
* http-duck ([API](https://random-d.uk/http))
|
||||||
- [random.cat](https://random.cat/)
|
- [random.cat](https://random.cat/)
|
||||||
* cat (API)
|
* cat (API)
|
||||||
- [RandomFox](https://randomfox.ca/)
|
- [RandomFox](https://randomfox.ca/)
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
const Command = require('../../structures/Command');
|
||||||
|
const request = require('node-superfetch');
|
||||||
|
|
||||||
|
module.exports = class HttpDuckCommand extends Command {
|
||||||
|
constructor(client) {
|
||||||
|
super(client, {
|
||||||
|
name: 'http-duck',
|
||||||
|
group: 'search',
|
||||||
|
memberName: 'http-duck',
|
||||||
|
description: 'Responds with a duck for an HTTP status code.',
|
||||||
|
clientPermissions: ['ATTACH_FILES'],
|
||||||
|
credit: [
|
||||||
|
{
|
||||||
|
name: 'Random-d.uk',
|
||||||
|
url: 'https://random-d.uk/',
|
||||||
|
reason: 'API',
|
||||||
|
reasonURL: 'https://random-d.uk/http'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
key: 'code',
|
||||||
|
prompt: 'What code do you want to get the duck of?',
|
||||||
|
type: 'integer'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(msg, { code }) {
|
||||||
|
try {
|
||||||
|
const { body, headers } = await request.get(`https://random-d.uk/api/http/${code}.jpg`);
|
||||||
|
return msg.say({ files: [{ attachment: body, name: `${code}.jpg` }] });
|
||||||
|
} catch (err) {
|
||||||
|
if (err.status === 404) return msg.say('Could not find any results.');
|
||||||
|
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "110.0.3",
|
"version": "110.1.0",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user