validate copy target

This commit is contained in:
Issue哥 2020-06-29 10:39:44 +08:00
parent 756aead980
commit ef362b51b8
1 changed files with 1 additions and 0 deletions

View File

@ -90,6 +90,7 @@ router.post('/api/gdurl/tgbot', async ctx => {
} }
} else if (text.startsWith('/copy')) { } else if (text.startsWith('/copy')) {
const target = text.replace('/copy', '').trim().split(' ').map(v => v.trim())[1] const target = text.replace('/copy', '').trim().split(' ').map(v => v.trim())[1]
if (target && !validate_fid(target)) return sm({ chat_id, text: `目标ID ${target} 格式不正确` })
tg_copy({ fid, target, chat_id }).then(task_id => { tg_copy({ fid, target, chat_id }).then(task_id => {
task_id && sm({ chat_id, text: `开始复制任务ID: ${task_id} 可输入 /task ${task_id} 查询进度` }) task_id && sm({ chat_id, text: `开始复制任务ID: ${task_id} 可输入 /task ${task_id} 查询进度` })
}) })