How to receive messages in group chats using telegram bot api
Talk to @botfather and disable the privacy mode.
Talk to @botfather and disable the privacy mode.
Talk to @botfather and disable the privacy mode.
The message updates you receive via getUpdates or your webhook will contain the chat ID for the specific message. It will be contained under the message.chat.id key. This seems like the only way you are able to retrieve the chat ID. So if you want to write something where the bot initiates the conversation you … Read more
This is now available! https://core.telegram.org/bots/api#getfile Hooray! It was added on Sep 18th (2015): https://core.telegram.org/bots/api Usage: In the JSON of the message you will receive a file_id as before. An example of a message object with a voice file: { message_id: 2675, from: { id: 10000001, first_name: ‘john’, username: ‘john’ }, chat: { id: 10000001, first_name: … Read more
I found the way to write in private channels. You should convert it to public with some @channelName Send a message to this channel through the Bot API: https://api.telegram.org/bot111:222/sendMessage?chat_id=@channelName&text=123 As the response, you will get information with chat_id of your channel. { “ok” : true, “result” : { “chat” : { **”id” : -1001005582487,** “title” … Read more
In order to get the group chat id, do as follows: Add the Telegram BOT to the group. Get the list of updates for your BOT: https://api.telegram.org/bot<YourBOTToken>/getUpdates Ex: https://api.telegram.org/bot123456789:jbd78sadvbdy63d37gda37bd8/getUpdates Look for the “chat” object: {“update_id”:8393,”message”:{“message_id”:3,”from”:{“id”:7474,”first_name”:”AAA”},”chat”:{“id”:<group_ID>,”title”:””},”date”:25497,”new_chat_participant”:{“id”:71,”first_name”:”NAME”,”username”:”YOUR_BOT_NAME”}}} This is a sample of the response when you add your BOT into a group. Use the “id” of the … Read more
Now all clients allow to do it, but it’s not pretty simple. In any Telegram client: Open Channel info (in app title) Choose Administrators Add Administrator There will be no bots in contact list, so you need to search for it. Enter your bot’s username Clicking on it you make it as administrator.
As @Andy Lamb wrote in a comment, your problem is that you are managing only one “game”, so every player interacts with each other. You must find a way to identify the sender of each message, and manage a “game” for each player. A game object should be an instance of a class, maintaining all … Read more