Closed realrecordzLab closed 2 years ago
You can use better that bot.on('message') that is a global event "onText". Example for "/encrypt" command:
// Matches "/encrypt [your text]"
bot.onText(/\/encrypt (.+)/, (msg, match) => {
// 'match' is the result of executing the regexp above on the text content of the message
const chatId = msg.chat.id;
const resp = match[1]; // the captured "your text"
bot.sendMessage(chatId, resp);
});
I have created a simple bot that is able to send and receive files. I need a way to get a password for the files that are sent to the bot from the users but at the moment I don't know how to proceed, I'm only able to get the commands but how I will get only the text that is following the command?
At the monent I have this three commands in my code. It will be more easy to get the password for the files before thy are sent.