feat: Add address validation and initial user instructions
This commit is contained in:
1 parent
2cbd2ec572
commit
fb1fe0c243
1 file changed
+16
-1
+16
-1
@@ -56,9 +56,24 @@ export class TelegramBot {
|
|||||||
|
|
||||||
this.bot.on('text', async (ctx) => {
|
this.bot.on('text', async (ctx) => {
|
||||||
const chatId = ctx.chat.id;
|
const chatId = ctx.chat.id;
|
||||||
const userMessage = ctx.message.text;
|
const userMessage = ctx.message.text.trim();
|
||||||
console.log(`Received message from chat ${chatId}: ${userMessage}`);
|
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 {
|
try {
|
||||||
const userPipeline: Pipeline = {
|
const userPipeline: Pipeline = {
|
||||||
description: 'Crypto wallet analyzer for Liquidswap',
|
description: 'Crypto wallet analyzer for Liquidswap',
|
||||||
|
|||||||
Reference in new issue
Block a user