Answer the question
In order to leave comments, you need to log in
How to make it so that after creating a link, the bot sends it to the chat?
I sketched the code, but it behaves strangely. When I run the bot with this code, it stupidly does not respond to any command and there are no errors in the console. I checked with the console.log command, then for some reason the bot starts processing this code immediately after launch. Can you post the correct working code?
bot.onText(/links/, function (msg) {
var chatId = msg.chat.id;
bot.exportChatInviteLink(chatId);
bot.sendMessage(chatId, bot.getChat(msg.chat.invite_link));
});
Answer the question
In order to leave comments, you need to log in
bot.onText(/links/, function (msg) {
var chatId = msg.chat.id;
#bot.exportChatInviteLink(chatId);
bot.sendMessage(chatId, bot.getChat(msg.chat.invite_link(chatId));
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question