From fb1fe0c2434676a9142f169da37120277548e839 Mon Sep 17 00:00:00 2001 From: uxname Date: Tue, 3 Jun 2025 00:04:01 +0300 Subject: [PATCH] feat: Add address validation and initial user instructions --- src/bot/telegram-bot.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/bot/telegram-bot.ts b/src/bot/telegram-bot.ts index df39628..0d168ab 100644 --- a/src/bot/telegram-bot.ts +++ b/src/bot/telegram-bot.ts @@ -56,9 +56,24 @@ export class TelegramBot { this.bot.on('text', async (ctx) => { const chatId = ctx.chat.id; - const userMessage = ctx.message.text; + const userMessage = ctx.message.text.trim(); console.log(`Received message from chat ${chatId}: ${userMessage}`); + const isAptosAddress = /^0x[a-fA-F0-9]{64}$/.test(userMessage); + + if (!isAptosAddress) { + await ctx.reply(`For now, I'm limited to preparing a personalized Telegram report with recommendations. To make this as accurate and helpful as possible, I'll need your Aptos address so I can access the latest information about your portfolio. + +Could you please share your Aptos address? Here's what I'll do once I receive it: + +1. Collect data on your tokens, pools, yields, and liquidity from Liquidswap. +2. Analyze your portfolio. +3. Prepare tailored recommendations and format them into a Telegram post with emojis and detailed explanations. + +Looking forward to helping you! 🚀`); + return; + } + try { const userPipeline: Pipeline = { description: 'Crypto wallet analyzer for Liquidswap',