mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Advice slip Command
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 (307)
|
||||
## Commands (308)
|
||||
### Utility:
|
||||
|
||||
* **prefix**: Shows or sets the command prefix.
|
||||
@@ -54,6 +54,7 @@ information and support.
|
||||
### Random Response:
|
||||
|
||||
* **8-ball**: Asks your question to the Magic 8 Ball.
|
||||
* **advice-slip**: Responds with a random bit of advice.
|
||||
* **cat-fact**: Responds with a random cat fact.
|
||||
* **cat**: Responds with a random cat image.
|
||||
* **charlie-charlie-challenge**: Asks your question to Charlie.
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class AdviceSlipCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'advice-slip',
|
||||
aliases: ['advice'],
|
||||
group: 'random',
|
||||
memberName: 'advice-slip',
|
||||
description: 'Responds with a random bit of advice.'
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
try {
|
||||
const { raw } = await snekfetch.get('http://api.adviceslip.com/advice');
|
||||
return msg.say(JSON.parse(raw.toString()).slip.advice);
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "75.0.4",
|
||||
"version": "75.1.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user