From 440c09eba3e5ec832fb29e4b2ab2af7aaa5856ed Mon Sep 17 00:00:00 2001 From: derpystuff <3515180-derpystuff@users.noreply.gitlab.com> Date: Wed, 13 Sep 2023 00:46:18 +0200 Subject: [PATCH] add labels to words --- commands/message/utils/dictionary.js | 18 ++++++++++++------ labscore/constants.js | 3 ++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/commands/message/utils/dictionary.js b/commands/message/utils/dictionary.js index af81ba6..f6d176c 100644 --- a/commands/message/utils/dictionary.js +++ b/commands/message/utils/dictionary.js @@ -7,6 +7,10 @@ const { dictionary } = require('../../../labscore/api'); const { Permissions } = require("detritus-client/lib/constants"); +const LABELS = { + "offensive": `${iconPill("warning", "Offensive")}` +} + function createDictionaryPage(context, result, index){ let phon = '' if(result.phonetic) phon = `\n*${result.phonetic}*` @@ -21,18 +25,20 @@ function createDictionaryPage(context, result, index){ let word = result.entries[index] let defItms = [] + let i = 1; for(const def of word.definitions){ - let entry = `${i}. ${def.definition}\n - *${def.example}*` - if(def.synonyms) entry += `\n${icon("empty")}${def.synonyms.splice(0, 5).map((s)=>smallPill(s)).join(' ')}` + let entry = `${i}. ${def.definition}` + if(def.example) entry += `\n - *${def.example}*` + if(def.synonyms) entry += `\n${icon("empty")}${def.synonyms.splice(0, 4).map((s)=>smallPill(s)).join(' ')}` defItms.push(entry) i++ } - e.fields.push({ - name: word.type, - value: defItms.join('\n') - }) + let type = word.type + if(word.labels) type += " " + word.labels.map((label)=>{if(LABELS[label]) return LABELS[label]; else return ""}).join(' ') + + e.description += `\n\n**${type}**\n${defItms.join('\n\n')}` let res = {"embeds": [e]} return res; diff --git a/labscore/constants.js b/labscore/constants.js index 07399c1..c7bf847 100644 --- a/labscore/constants.js +++ b/labscore/constants.js @@ -178,10 +178,11 @@ module.exports.REDESIGN_ICONS = Object.freeze({ "information": "<:ico_information:1139704769179562064>", "question": "<:ico_question:1139704770760806502>", + "warning": "<:ico_warning:1151286226117201970>", // Internal Icons "empty": "<:e:749601069298090034>", - + // Legacy Icon Compat "success_simple": "<:lc_success:699608002910617670>", "failiure_simple": "<:lc_denied:688071041787887647>",