Adding examples to dictionary if one is provided
This commit is contained in:
parent
34a842b707
commit
d85912e80d
@ -70,10 +70,18 @@ module.exports = {
|
|||||||
console.log("audio downloaded")
|
console.log("audio downloaded")
|
||||||
console.log(response.body)
|
console.log(response.body)
|
||||||
data.meanings.forEach(wordData => {
|
data.meanings.forEach(wordData => {
|
||||||
|
|
||||||
|
if (wordData.definitions[0].example) {
|
||||||
|
meaningsArray.push({
|
||||||
|
"name": wordData.partOfSpeech,
|
||||||
|
"value": wordData.definitions[0].definition + "\nExample: " + wordData.definitions[0].example
|
||||||
|
})
|
||||||
|
} else {
|
||||||
meaningsArray.push({
|
meaningsArray.push({
|
||||||
"name": wordData.partOfSpeech,
|
"name": wordData.partOfSpeech,
|
||||||
"value": wordData.definitions[0].definition
|
"value": wordData.definitions[0].definition
|
||||||
})
|
})
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const file = new AttachmentBuilder('./audio/' + rand + ".mp3");
|
const file = new AttachmentBuilder('./audio/' + rand + ".mp3");
|
||||||
|
Loading…
Reference in New Issue
Block a user