mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-09 14:43:05 -04:00
add labels to words
This commit is contained in:
parent
a139c9b406
commit
440c09eba3
2 changed files with 14 additions and 7 deletions
|
@ -7,6 +7,10 @@ const { dictionary } = require('../../../labscore/api');
|
||||||
|
|
||||||
const { Permissions } = require("detritus-client/lib/constants");
|
const { Permissions } = require("detritus-client/lib/constants");
|
||||||
|
|
||||||
|
const LABELS = {
|
||||||
|
"offensive": `${iconPill("warning", "Offensive")}`
|
||||||
|
}
|
||||||
|
|
||||||
function createDictionaryPage(context, result, index){
|
function createDictionaryPage(context, result, index){
|
||||||
let phon = ''
|
let phon = ''
|
||||||
if(result.phonetic) phon = `\n*${result.phonetic}*`
|
if(result.phonetic) phon = `\n*${result.phonetic}*`
|
||||||
|
@ -21,18 +25,20 @@ function createDictionaryPage(context, result, index){
|
||||||
let word = result.entries[index]
|
let word = result.entries[index]
|
||||||
let defItms = []
|
let defItms = []
|
||||||
|
|
||||||
|
|
||||||
let i = 1;
|
let i = 1;
|
||||||
for(const def of word.definitions){
|
for(const def of word.definitions){
|
||||||
let entry = `${i}. ${def.definition}\n - *${def.example}*`
|
let entry = `${i}. ${def.definition}`
|
||||||
if(def.synonyms) entry += `\n${icon("empty")}${def.synonyms.splice(0, 5).map((s)=>smallPill(s)).join(' ')}`
|
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)
|
defItms.push(entry)
|
||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
|
|
||||||
e.fields.push({
|
let type = word.type
|
||||||
name: word.type,
|
if(word.labels) type += " " + word.labels.map((label)=>{if(LABELS[label]) return LABELS[label]; else return ""}).join(' ')
|
||||||
value: defItms.join('\n')
|
|
||||||
})
|
e.description += `\n\n**${type}**\n${defItms.join('\n\n')}`
|
||||||
|
|
||||||
let res = {"embeds": [e]}
|
let res = {"embeds": [e]}
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -178,6 +178,7 @@ module.exports.REDESIGN_ICONS = Object.freeze({
|
||||||
|
|
||||||
"information": "<:ico_information:1139704769179562064>",
|
"information": "<:ico_information:1139704769179562064>",
|
||||||
"question": "<:ico_question:1139704770760806502>",
|
"question": "<:ico_question:1139704770760806502>",
|
||||||
|
"warning": "<:ico_warning:1151286226117201970>",
|
||||||
|
|
||||||
// Internal Icons
|
// Internal Icons
|
||||||
"empty": "<:e:749601069298090034>",
|
"empty": "<:e:749601069298090034>",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue