Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
authorId,
crossPlatformResponseData,
) {
const chapterForEmojiName = {};
/* Create the Jisho (J) chapter */
const word = crossPlatformResponseData.searchPhrase;
const discordContents = JishoDiscordContentFormatter.formatJishoDataBig(
crossPlatformResponseData,
true,
true,
authorName,
);
const jishoNavigationChapter = NavigationChapter.fromContent(discordContents);
chapterForEmojiName[JISHO_EMOTE] = jishoNavigationChapter;
/* Create the Kanji (K) chapter */
const kanjiNavigationChapterInformation = createNavigationChapterInformationForKanji(
authorName,
word,
msg.prefix,
);
if (kanjiNavigationChapterInformation.hasAnyPages) {
chapterForEmojiName[KANJI_EMOTE] =
kanjiNavigationChapterInformation.navigationChapter;
}
/* Create the stroke order (S) chapter */
value: usageExamples.length !== 0 ? usageExamples.join('・') : '-',
inline: false,
};
const embed = {
title: `${keyword} - 用例.jp Search Results`,
url: self,
color: constants.EMBED_NEUTRAL_COLOR,
fields: [frequencyField, usageExampleField],
footer: {
icon_url: constants.FOOTER_ICON_URI,
text: `${authorName} can use the reaction buttons below to see more information!`,
},
};
return NavigationChapter.fromContent([trimEmbed({ embed })]);
}
value: scrapeResult.data.usageExamples.join('・'),
inline: false,
};
const embed = {
title: `${keyword} - 用例.jp Search Results`,
url: scrapeResult.links.self,
color: constants.EMBED_NEUTRAL_COLOR,
fields: [frequencyField, usageExampleField],
footer: {
icon_url: constants.FOOTER_ICON_URI,
text: `${authorName} can use the reaction buttons below to see more information!`,
},
};
return NavigationChapter.fromContent([trimEmbed({ embed })]);
}
url: self,
fields: [],
color: constants.EMBED_NEUTRAL_COLOR,
footer: {
icon_url: constants.FOOTER_ICON_URI,
text: `${authorName} can use the reaction buttons below to see more information!`,
},
};
for (let i = 0; i < EXAMPLES_PER_PAGE; i += 1) {
if (fields.length !== 0) embed.fields.push(fields.pop());
}
pages.push(trimEmbed({ embed }));
pageNumber += 1;
}
return NavigationChapter.fromContent(pages);
}
url: self,
fields: [],
color: constants.EMBED_NEUTRAL_COLOR,
footer: {
icon_url: constants.FOOTER_ICON_URI,
text: `${authorName} can use the reaction buttons below to see more information!`,
},
};
for (let i = 0; i < EXAMPLES_PER_PAGE; i += 1) {
embed.fields.push(fields.pop());
}
pages.push(trimEmbed({ embed }));
pageNumber += 1;
}
return NavigationChapter.fromContent(pages);
}