From dff842e3d2170adea2cfa07f9479fc28db95f3bd Mon Sep 17 00:00:00 2001 From: Astrian Zheng Date: Mon, 8 Apr 2019 17:49:27 +0800 Subject: [PATCH 1/3] add check up status for /importrsvp command --- app.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app.js b/app.js index d7a79c4..2d2cfb6 100644 --- a/app.js +++ b/app.js @@ -105,6 +105,9 @@ telegrafbot.command('importrsvp', async (ctx) =>{ try { let info = await API.checkpoc(ctx.message.from.id) + // check up poc info and ap logging status + await API.checkapstatus(info.faction, info.location, ctx.message.from.id) + // if user only send the '/importrsvp' command, reply the help infomation if (ctx.message.text.slice(12) === '') { let reply = '' From 0ba8f65b780d2fef720afc9584193e2b55f4ed39 Mon Sep 17 00:00:00 2001 From: Astrian Zheng Date: Mon, 8 Apr 2019 17:52:00 +0800 Subject: [PATCH 2/3] add /help command --- app.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/app.js b/app.js index 2d2cfb6..914b2f9 100644 --- a/app.js +++ b/app.js @@ -135,6 +135,44 @@ telegrafbot.command('importrsvp', async (ctx) =>{ telegrambot.sendMessage(ctx.message.from.id, err, {parse_mode: "Markdown"}) } }) +telegrafbot.command('help', async (ctx) =>{ + try { + let info = await API.checkpoc(ctx.message.from.id) + + // check up poc info and ap logging status + await API.checkapstatus(info.faction, info.location, ctx.message.from.id) + + let message = '需要帮助吗?这些链接可能可以帮到你。\n' + telegrambot.sendMessage( + ctx.message.from.id, + message, + { + parse_mode: "Markdown", + reply_markup: { + inline_keyboard: [ + [{ + text: '查阅帮助文档', + url: `https://github.com/Astrian/IFS-RSVP-Bot/wiki` + }], + [{ + text: '订阅频道', + url: `https://t.me/ifsrsvpbot` + }], + [{ + text: '加入反馈群', + url: `https://t.me/joinchat/A0P0mxHipaEeJ-4vzKgTuQ` + }] + ] + } + } + ) + + } catch (err) { + console.log('error accourd!') + console.log(err) + telegrambot.sendMessage(ctx.message.from.id, err, {parse_mode: "Markdown"}) + } +}) // Inline button telegrafbot.on('callback_query', async (ctx) => { From 577aca78c4064ba3227ab152c343276287ecdd37 Mon Sep 17 00:00:00 2001 From: Astrian Zheng Date: Mon, 8 Apr 2019 17:52:34 +0800 Subject: [PATCH 3/3] new command guide --- app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.js b/app.js index 914b2f9..54400d4 100644 --- a/app.js +++ b/app.js @@ -24,7 +24,7 @@ telegrafbot.telegram.setWebhook(process.env.DOMAIN + process.env.RANDOM_ADDRESS) telegrafbot.command('start', async (ctx) => { try { let info = await API.checkpoc(ctx.message.from.id) - telegrambot.sendMessage(ctx.message.from.id, `欢迎你,${info.location} 场 ${info.faction} 签到人员。\n\n/importrsvp - 导入你所在阵营的特工\n/checkin - 进行签到\n/checkout - 进行签退`, {parse_mode: "Markdown"}) + telegrambot.sendMessage(ctx.message.from.id, `欢迎你,${info.location} 场 ${info.faction} 签到人员。\n\n/importrsvp - 导入你所在阵营的特工\n/checkin - 进行签到\n/checkout - 进行签退\n/help - 寻求帮助`, {parse_mode: "Markdown"}) } catch (err) { telegrambot.sendMessage(ctx.message.from.id, err, {parse_mode: "Markdown"}) }