修正tg bot按鈕顯示

This commit is contained in:
liaojack8 2020-07-06 21:18:00 +08:00
parent 0c867ff8f0
commit a3b0c2c9bb
1 changed files with 4 additions and 3 deletions

View File

@ -98,7 +98,9 @@ function send_choice ({ fid, chat_id }) {
reply_markup: { reply_markup: {
inline_keyboard: [ inline_keyboard: [
[ [
{ text: '文件統計', callback_data: `count ${fid}` }, { text: '文件統計', callback_data: `count ${fid}` }
],
[
{ text: '開始複製', callback_data: `copy ${fid}` } { text: '開始複製', callback_data: `copy ${fid}` }
] ]
].concat(gen_bookmark_choices(fid)) ].concat(gen_bookmark_choices(fid))
@ -111,9 +113,8 @@ function gen_bookmark_choices (fid) {
const gen_choice = v => ({text: `複製到 ${v.alias}`, callback_data: `copy ${fid} ${v.alias}`}) const gen_choice = v => ({text: `複製到 ${v.alias}`, callback_data: `copy ${fid} ${v.alias}`})
const records = db.prepare('select * from bookmark').all() const records = db.prepare('select * from bookmark').all()
const result = [] const result = []
for (let i = 0; i < records.length; i += 2) { for (let i = 0; i < records.length; i++) {
const line = [gen_choice(records[i])] const line = [gen_choice(records[i])]
if (records[i + 1]) line.push(gen_choice(records[i + 1]))
result.push(line) result.push(line)
} }
return result return result