diff --git a/commands/message/fun/bard.js b/commands/message/fun/bard.js index 991bbb6..be163c6 100644 --- a/commands/message/fun/bard.js +++ b/commands/message/fun/bard.js @@ -9,6 +9,8 @@ const { iconPill, smallIconPill, icon } = require('../../../labscore/utils/markd const { Permissions } = require("detritus-client/lib/constants"); +const BLOCKED_PHRASES = process.env.BARD_BLOCKLIST.split(';') + module.exports = { name: 'bard', label: 'text', @@ -32,11 +34,13 @@ module.exports = { let input = args.text; + for(const p of BLOCKED_PHRASES) if(input.toLowerCase().includes(p)) return await editOrReply(context, createEmbed("error", context, "Query includes blocked phrases. This incident will be reported.")); + let inputDisplay = args.text.replace(/\n/g, ' ') if(inputDisplay.length >= 50) inputDisplay = inputDisplay.substr(0,50) + '...' try{ - await editOrReply(context, createEmbed("ai_bard", context, inputDisplay)) + await editOrReply(context, createEmbed("ai_custom", context, STATIC_ICONS.ai_bard)) let res = await superagent.post(`${process.env.AI_SERVER}/google/bard`) .set({ diff --git a/commands/message/fun/palm.js b/commands/message/fun/palm.js index c60bebb..0ce6100 100644 --- a/commands/message/fun/palm.js +++ b/commands/message/fun/palm.js @@ -57,7 +57,7 @@ module.exports = { if(inputDisplay.length >= 50) inputDisplay = inputDisplay.substr(0,50) + '...' try{ - await editOrReply(context, createEmbed("ai_bard", context, inputDisplay)) + await editOrReply(context, createEmbed("ai_custom", context, STATIC_ICONS.ai_palm_idle)) let res = await superagent.post(`${process.env.AI_SERVER}/google/palm2`) .set({ @@ -87,7 +87,7 @@ module.exports = { embeds:[createEmbed("defaultNoFooter", context, { author: { name: inputDisplay, - iconUrl: STATIC_ICONS.ai_bard_idle + iconUrl: STATIC_ICONS.ai_palm_idle }, description: description.join('\n'), footer: { diff --git a/labscore/utils/embed.js b/labscore/utils/embed.js index 350d681..4a0b5a1 100644 --- a/labscore/utils/embed.js +++ b/labscore/utils/embed.js @@ -88,10 +88,10 @@ const embedTypes = Object.freeze({ color: COLORS.embed } }, - "ai_bard": (context) => { + "ai_custom": (context) => { return { author: { - iconUrl: STATIC_ICONS.ai_bard, + iconUrl: STATIC_ICONS.ai, name: `​` }, image: { @@ -112,6 +112,10 @@ module.exports.createEmbed = function(type, context, content){ emb.author.name = content return emb } + + if(["ai_custom"].includes(type)){ + emb.author.iconUrl = content + } if(["errordetail"].includes(type)){ emb.author.name = content.error diff --git a/labscore/utils/statics.js b/labscore/utils/statics.js index 467b360..7a187ef 100644 --- a/labscore/utils/statics.js +++ b/labscore/utils/statics.js @@ -136,6 +136,10 @@ const Statics = Object.freeze({ file: "icons/core/ico_notice_bard_idle.gif", revision: 0 }, + ai_palm_idle: { + file: "icons/core/ico_notice_palm_idle.png", + revision: 0 + }, warning: { file: "icons/core/ico_notice_warning.png", revision: 0 @@ -181,6 +185,7 @@ module.exports.STATIC_ICONS = Object.freeze({ ai: staticAsset(Statics.icons.ai), ai_bard: staticAsset(Statics.icons.ai_bard), ai_bard_idle: staticAsset(Statics.icons.ai_bard_idle), + ai_palm_idle: staticAsset(Statics.icons.ai_palm_idle), warning: staticAsset(Statics.icons.warning) })