Reputation: 117
I have Telegram-bot, which send messages to all users, which have conversation channel with it.
How i can get all this bot's messages? Does it have some log functionality? Or on C# API can I create it?
Upvotes: 1
Views: 3614
Reputation: 3235
If you just want to have all messages, received by bot, the simplest way to store all bot's message without the need for databases, files, etc - is to forward all messages received by bot to your personal account or to group chat.
Example:
bot.on('message', (msg) => {
// do something with msg here
bot.forwardMessage(process.env.DEVELOPER_CHAT_ID, msg.chat.id, msg.message_id);
})
Upvotes: 0
Reputation: 134
Bot API doesn't provide a way of fetching the chat history, you get every update only once.
You will have to save messages as they come in, probably in a database.
Upvotes: 1