22 lines
549 B
JavaScript
22 lines
549 B
JavaScript
import pkg from 'mirai-js'
|
||
const { Message } = pkg
|
||
|
||
export function genRecipeMessage(recipeList, header, footer) {
|
||
const msg = new Message()
|
||
if (header) {
|
||
msg.addText(`${header}\n\n`);
|
||
}
|
||
recipeList.forEach((recipe, index)=> {
|
||
msg.addText(`${index + 1}. ${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\n`)
|
||
})
|
||
|
||
if (footer) {
|
||
msg.addText(`${footer}`);
|
||
}
|
||
|
||
return msg
|
||
}
|