From 03af849964231014e7c074703174d5e4f53d19bc Mon Sep 17 00:00:00 2001 From: derpystuff <3515180-derpystuff@users.noreply.gitlab.com> Date: Wed, 31 May 2023 19:44:20 +0200 Subject: [PATCH] inspire --- commands/message/fun/inspire.js | 35 +++++++++++++++++++++++++++++++++ labscore/utils/statics.js | 10 ++++++++++ 2 files changed, 45 insertions(+) create mode 100644 commands/message/fun/inspire.js diff --git a/commands/message/fun/inspire.js b/commands/message/fun/inspire.js new file mode 100644 index 0000000..110250a --- /dev/null +++ b/commands/message/fun/inspire.js @@ -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.`)]}) + } + } +}; \ No newline at end of file diff --git a/labscore/utils/statics.js b/labscore/utils/statics.js index 1f534be..e20dd98 100644 --- a/labscore/utils/statics.js +++ b/labscore/utils/statics.js @@ -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),