node-telegram-bot-api icon indicating copy to clipboard operation
node-telegram-bot-api copied to clipboard

How do i make user input?

Open GuckTubeYT opened this issue 3 years ago • 6 comments

so, i want to make user input, so, when user send file, and then bot download the file by getting the link attachment but how?

GuckTubeYT avatar Feb 20 '22 06:02 GuckTubeYT

Please someone help me

GuckTubeYT avatar Feb 21 '22 05:02 GuckTubeYT

What do you mean for user input?

realrecordzLab avatar Mar 22 '22 10:03 realrecordzLab

When user do message, and then the bot read it, example

User = /saymyname Bot = what is your name? User = GuckTube Bot = Hello GuckTube!

GuckTubeYT avatar Mar 24 '22 08:03 GuckTubeYT

Why when i try "git clone https://github.com/gucktubeyt/enetproxy" it is not working

TorkW avatar Apr 13 '22 23:04 TorkW

If I understood your question right you can use matched message after bot command "/saymyname" Example: User sends: /sayyname John Doe Bot answers: Hello John Doe!

bot.onText (/\/saymyname (.+)/, (msg, match) => {
      let name = match [1];
      bot.sendMessage (msg.chat.id, `Hello ${name}!`);   //pay attention to the type of quotes
}

If you want your bot to recieve and perceive next message from user as his/her name without bot command you need to save user instance after bot command, but I do not recommend to do so, since it will complicate your code. You may also find usefull this issue: (https://github.com/yagop/node-telegram-bot-api/issues/890#issue-945268000)

ddavlet avatar Jul 02 '22 12:07 ddavlet

https://github.com/yagop/node-telegram-bot-api/issues/979#issuecomment-1190121338

IscoV avatar Jul 20 '22 10:07 IscoV