mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-09 14:43:05 -04:00
otter
This commit is contained in:
parent
a2f195f983
commit
e007a1b97c
1 changed files with 34 additions and 0 deletions
34
commands/interaction/slash/fun/otter.js
Normal file
34
commands/interaction/slash/fun/otter.js
Normal file
|
@ -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.`))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
Loading…
Add table
Add a link
Reference in a new issue