mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-10 07:03:08 -04:00
inspire
This commit is contained in:
parent
9e84ba161d
commit
03af849964
2 changed files with 45 additions and 0 deletions
35
commands/message/fun/inspire.js
Normal file
35
commands/message/fun/inspire.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
const { createEmbed } = require('../../../labscore/utils/embed')
|
||||
const { editOrReply } = require('../../../labscore/utils/message')
|
||||
|
||||
const superagent = require('superagent');
|
||||
const { STATICS } = require('../../../labscore/utils/statics');
|
||||
|
||||
module.exports = {
|
||||
name: 'inspire',
|
||||
metadata: {
|
||||
description: 'Generates a random inspirational quote.',
|
||||
description_short: 'Inspirational Quotes',
|
||||
examples: ['inspire'],
|
||||
category: 'fun',
|
||||
usage: `inspire`
|
||||
},
|
||||
run: async (context) => {
|
||||
await context.triggerTyping();
|
||||
try{
|
||||
let res = await superagent.get(`https://inspirobot.me/api?generate=true`)
|
||||
.set("User-Agent","labscore/2.0")
|
||||
|
||||
return await editOrReply(context, {
|
||||
embeds: [ createEmbed("image", context, {
|
||||
url: res.text,
|
||||
provider: {
|
||||
icon: STATICS.inspirobot,
|
||||
text: "Inspirobot"
|
||||
}
|
||||
})]
|
||||
})
|
||||
}catch(e){
|
||||
return editOrReply(context, {embeds:[createEmbed("error", context, `Unable to fetch inspirational quote.`)]})
|
||||
}
|
||||
}
|
||||
};
|
|
@ -4,6 +4,10 @@ const { Hosts } = require('../api/endpoints')
|
|||
// Update the revision id to break discord cache
|
||||
const Statics = Object.freeze({
|
||||
brands: {
|
||||
applemaps: {
|
||||
file: "brands/applemaps.png",
|
||||
revision: 1
|
||||
},
|
||||
bing: {
|
||||
file: "brands/bing.png",
|
||||
revision: 0
|
||||
|
@ -24,6 +28,10 @@ const Statics = Object.freeze({
|
|||
file: "brands/inferkit.png",
|
||||
revision: 0
|
||||
},
|
||||
inspirobot: {
|
||||
file: "brands/inspirobot.png",
|
||||
revision: 0
|
||||
},
|
||||
makesweet: {
|
||||
file: "brands/makesweet.png",
|
||||
revision: 0
|
||||
|
@ -94,11 +102,13 @@ function staticAsset(static) {
|
|||
}
|
||||
|
||||
module.exports.STATICS = Object.freeze({
|
||||
applemaps: staticAsset(Statics.brands.applemaps),
|
||||
bing: staticAsset(Statics.brands.bing),
|
||||
genius: staticAsset(Statics.brands.genius),
|
||||
google: staticAsset(Statics.brands.google),
|
||||
emojipedia: staticAsset(Statics.brands.emojipedia),
|
||||
inferkit: staticAsset(Statics.brands.inferkit),
|
||||
inspirobot: staticAsset(Statics.brands.inspirobot),
|
||||
makesweet: staticAsset(Statics.brands.makesweet),
|
||||
openweathermap: staticAsset(Statics.brands.openweathermap),
|
||||
perspectiveapi: staticAsset(Statics.brands.perspectiveapi),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue