From e007a1b97c43c2b19f4e05f3cb020e4d124683ba Mon Sep 17 00:00:00 2001 From: derpystuff <3515180-derpystuff@users.noreply.gitlab.com> Date: Mon, 25 Mar 2024 11:33:54 +0100 Subject: [PATCH] otter --- commands/interaction/slash/fun/otter.js | 34 +++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 commands/interaction/slash/fun/otter.js diff --git a/commands/interaction/slash/fun/otter.js b/commands/interaction/slash/fun/otter.js new file mode 100644 index 0000000..aa0c28d --- /dev/null +++ b/commands/interaction/slash/fun/otter.js @@ -0,0 +1,34 @@ +const { createEmbed } = require('../../../../labscore/utils/embed') +const { editOrReply } = require('../../../../labscore/utils/message') + +const { InteractionCallbackTypes } = require("detritus-client/lib/constants"); +const { otter } = require('../../../../labscore/api'); + +module.exports = { + description: 'Shows a random otter picture.', + name: 'otter', + contexts: [ + 0, + 1, + 2 + ], + integrationTypes: [ + 1 + ], + run: async (context) => { + await context.respond({data: {}, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE}) + + try{ + const ott = (await otter()).response.body + + return editOrReply(context, createEmbed("default", context, { + image: { + url: ott.url + } + })) + }catch(e){ + console.log(e) + return editOrReply(context, createEmbed("error", context, `Unable to fetch otter.`)) + } + } +}; \ No newline at end of file