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