test
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
mol
2023-12-14 14:59:41 +08:00
parent 16196c46ac
commit cf18fdf532
2 changed files with 23 additions and 15 deletions

View File

@ -1,19 +1,21 @@
import pkg from 'mirai-js'
const { Message } = pkg
export function genRecipeMessage(recipeList, header, footer) {
const textList = [];
for (let recipe of recipeList) {
textList.push(
`${recipe.name}\n材料:${recipe.stuff}\n厨具:${recipe.tools}\nhttps://www.bilibili.com/video/${recipe.bv}`,
);
}
const msg = new Message()
if (header) {
textList.unshift(header);
msg.addText(`${header}\n`);
}
recipeList.forEach((recipe, index)=> {
msg.addText(`${index}. ${recipe.name}\n`)
msg.addText(`\t· 材料:${recipe.stuff}\n`)
msg.addText(`\t· 厨具:${recipe.tools}\n`)
msg.addText(`\t· 制作视频https://www.bilibili.com/video/${recipe.bv}\n`)
})
if (footer) {
textList.push(footer);
msg.addText(`${footer}`);
}
return textList.join('\n \n');
return msg
}