mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-09 06:33:05 -04:00
34 lines
No EOL
895 B
JavaScript
34 lines
No EOL
895 B
JavaScript
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.`))
|
|
}
|
|
}
|
|
}; |