P
P
PegasusPega2021-01-22 01:41:15
Node.js
PegasusPega, 2021-01-22 01:41:15

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

1 answer(s)
A
Anonymous Coder, 2021-01-22
@Geza420

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 question

Ask a Question

731 491 924 answers to any question