This commit is contained in:
derpystuff 2023-05-31 19:44:20 +02:00
parent 9e84ba161d
commit 03af849964
2 changed files with 45 additions and 0 deletions

View 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.`)]})
}
}
};

View file

@ -4,6 +4,10 @@ const { Hosts } = require('../api/endpoints')
// Update the revision id to break discord cache // Update the revision id to break discord cache
const Statics = Object.freeze({ const Statics = Object.freeze({
brands: { brands: {
applemaps: {
file: "brands/applemaps.png",
revision: 1
},
bing: { bing: {
file: "brands/bing.png", file: "brands/bing.png",
revision: 0 revision: 0
@ -24,6 +28,10 @@ const Statics = Object.freeze({
file: "brands/inferkit.png", file: "brands/inferkit.png",
revision: 0 revision: 0
}, },
inspirobot: {
file: "brands/inspirobot.png",
revision: 0
},
makesweet: { makesweet: {
file: "brands/makesweet.png", file: "brands/makesweet.png",
revision: 0 revision: 0
@ -94,11 +102,13 @@ function staticAsset(static) {
} }
module.exports.STATICS = Object.freeze({ module.exports.STATICS = Object.freeze({
applemaps: staticAsset(Statics.brands.applemaps),
bing: staticAsset(Statics.brands.bing), bing: staticAsset(Statics.brands.bing),
genius: staticAsset(Statics.brands.genius), genius: staticAsset(Statics.brands.genius),
google: staticAsset(Statics.brands.google), google: staticAsset(Statics.brands.google),
emojipedia: staticAsset(Statics.brands.emojipedia), emojipedia: staticAsset(Statics.brands.emojipedia),
inferkit: staticAsset(Statics.brands.inferkit), inferkit: staticAsset(Statics.brands.inferkit),
inspirobot: staticAsset(Statics.brands.inspirobot),
makesweet: staticAsset(Statics.brands.makesweet), makesweet: staticAsset(Statics.brands.makesweet),
openweathermap: staticAsset(Statics.brands.openweathermap), openweathermap: staticAsset(Statics.brands.openweathermap),
perspectiveapi: staticAsset(Statics.brands.perspectiveapi), perspectiveapi: staticAsset(Statics.brands.perspectiveapi),