diction - filter empty definitions
This commit is contained in:
parent
2b42fb63f4
commit
dfd0337397
@ -2,7 +2,7 @@
|
||||
"main": "plugin.js",
|
||||
"name": "diction",
|
||||
"description": "Find definitions for words",
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.2",
|
||||
"tags": ["commands", "utility", "dictionary"],
|
||||
"dependencies": ["simplecommands"],
|
||||
"npmDependencies": []
|
||||
|
@ -160,7 +160,9 @@ class DictionPlugin extends Plugin {
|
||||
lastTime: Date.now(),
|
||||
}
|
||||
],
|
||||
definitions: (response as Record<string, string>[]).map(({ partOfSpeech, text }) => ({
|
||||
definitions: (response as Record<string, string>[])
|
||||
.filter(entry => entry.text)
|
||||
.map(({ partOfSpeech, text }) => ({
|
||||
partOfSpeech, text: text.replace(/(<([^>]+)>)/ig, '')
|
||||
})),
|
||||
inserted: Date.now(),
|
||||
@ -182,7 +184,7 @@ class DictionPlugin extends Plugin {
|
||||
return true;
|
||||
},
|
||||
match: /define (\w*)/,
|
||||
aliases: ['df'],
|
||||
aliases: ['df', 'word'],
|
||||
description: 'Find definitions for words. Call again to advance to next definition',
|
||||
usage: '<word>'
|
||||
});
|
||||
|
@ -11,7 +11,7 @@
|
||||
},
|
||||
{
|
||||
"name": "diction",
|
||||
"version": "1.2.1"
|
||||
"version": "1.2.2"
|
||||
},
|
||||
{
|
||||
"name": "fun",
|
||||
|
Loading…
Reference in New Issue
Block a user