diff --git a/commands/message/fun/otter.js b/commands/message/fun/otter.js index 3a3bb14..f7f52d2 100644 --- a/commands/message/fun/otter.js +++ b/commands/message/fun/otter.js @@ -4,6 +4,7 @@ const { editOrReply } = require('../../../labscore/utils/message') const superagent = require('superagent'); const { Permissions } = require("detritus-client/lib/constants"); +const { otter } = require('../../../labscore/api'); module.exports = { name: 'otter', @@ -17,16 +18,15 @@ module.exports = { run: async (context) => { await context.triggerTyping(); try{ - let res = await superagent.get(`https://otter.bruhmomentlol.repl.co/random`) - .set("User-Agent","labscore/2.0") + const ott = (await otter()).response.body - return await editOrReply(context, { - embeds: [ createEmbed("image", context, { - url: `otter.${res.headers["x-file-ext"]}` - })], - files: [{ filename: `otter.${res.headers["x-file-ext"]}`, value: res.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.`)) } } diff --git a/labscore/api/endpoints.js b/labscore/api/endpoints.js index 5dd9043..53bd8dc 100644 --- a/labscore/api/endpoints.js +++ b/labscore/api/endpoints.js @@ -54,6 +54,7 @@ const Api = Object.freeze({ UTILS_GARFIELD: '/utils/garfield', UTILS_INFERKIT: '/utils/inferkit', UTILS_MAPKIT: '/utils/mapkit', + UTILS_OTTER: '/utils/otter', UTILS_PERSPECTIVE: '/utils/perspective', UTILS_SCREENSHOT: '/utils/screenshot', UTILS_TEXTGENERATOR: '/utils/text-generator', diff --git a/labscore/api/index.js b/labscore/api/index.js index e3c4628..5e9ba04 100644 --- a/labscore/api/index.js +++ b/labscore/api/index.js @@ -304,7 +304,7 @@ module.exports.emojipedia = async function(context, emoji){ }) } -module.exports.garfield = async function(context, emoji){ +module.exports.garfield = async function(context,){ return await request(Api.UTILS_GARFIELD, "GET", {}, {}) } @@ -314,6 +314,10 @@ module.exports.inferkit = async function(context, input){ }) } +module.exports.otter = async function(context){ + return await request(Api.UTILS_OTTER, "GET", {}, {}) +} + module.exports.perspective = async function(context, content = []){ return await request(Api.UTILS_PERSPECTIVE, "GET", {}, { input: content.join('\n\n') diff --git a/labscore/api/obelisk/endpoints.js b/labscore/api/obelisk/endpoints.js index c0dcf93..fb61f0d 100644 --- a/labscore/api/obelisk/endpoints.js +++ b/labscore/api/obelisk/endpoints.js @@ -7,6 +7,7 @@ const ObeliskApi = Object.freeze({ HOST: ObeliskHosts.prod, GOOGLE_BARD: "/parrot/v1/google:bard", + GEMINI_PRO_VISION: "/parrot/v1/google:geminivision", SUMMARIZE_WEBPAGES: "/flamingo/v1/web:summarize" }) diff --git a/labscore/api/obelisk/index.js b/labscore/api/obelisk/index.js index 9e234a2..6d7613b 100644 --- a/labscore/api/obelisk/index.js +++ b/labscore/api/obelisk/index.js @@ -47,6 +47,13 @@ module.exports.bard = async function(context, input){ }) } +module.exports.geminiVision = async function(context, input, url){ + return await request(ObeliskApi.GOOGLE_BARD, "POST", {}, { + input, + url + }) +} + // FLAMINGO module.exports.summarizeWebpage = async function(context, url){ return await request(ObeliskApi.SUMMARIZE_WEBPAGES, "POST", {}, {