node-telegram-bot-api
node-telegram-bot-api copied to clipboard
How do i make user input?
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?
Please someone help me
What do you mean for user input?
When user do message, and then the bot read it, example
User = /saymyname Bot = what is your name? User = GuckTube Bot = Hello GuckTube!
Why when i try "git clone https://github.com/gucktubeyt/enetproxy" it is not working
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)
https://github.com/yagop/node-telegram-bot-api/issues/979#issuecomment-1190121338