javascript - 询问如何在 Telegram 中为内联查询创建数组
问题描述
如果我的搜索在电报和电报中是这样的,如何显示视频数据。我也希望视频和文档也可搜索?
bot.on('inline_query',async(ctx)=>{
query = ctx.inlineQuery.query
if(query.length>0){
let searchResult = saver.getfileInline(query).then((res)=>{
let result = res.map((ctx,index)=>{
return {
type:'document',
id:ctx._id,
title:ctx.file_name,
document_file_id:ctx.file_id,
caption:ctx.caption,
reply_markup:{
inline_keyboard:[
[{text:"Pencarian",switch_inline_query:''}]
]
}
}
})
ctx.answerInlineQuery(result)
})
}else{
console.log('query not found');
}
})
解决方案
推荐阅读
- c++ - 在 Linux 上使用 Mingw 编译 GMP 库
- javascript - 通过单击按钮逐行显示 csv 内容
- xamarin - OneSignal 推送通知中的 AdditionalData
- javascript - 将鼠标悬停在卡片上时,我可以更改卡片的图像。但是对于大量具有不同图像的卡片,我该如何做到这一点
- python - 在目标函数中加入主变量和辅助变量的乘积
- opencv - OpenCV4中TGA格式加载的任何解决方案
- java - 为什么 Lombok 在覆盖通用 getter 时会生成额外的 Getter?
- r - 从 R 导出西里尔字符?
- python - 我可以在异步协程上使用阻塞锁吗?
- tensorflow - tensorflow.keras.preprocessing.text.Tokenizer.texts_to_matrix 有什么作用?