I am following this example to have the bot send an inline keyboard. When I interact with the bot directly it works fine, but I had no success to have the bot send the keyboard in a group. The bot is an admin member of the group. When I send /start in the group I get no response from the bot. Is this a restriction of groups? Or there is something I need to modify in the code?
there may be different reasons for your problem, try these:
turn off/on group privacy for you bot via botfather.
if you have more than 1bot in the group, try commands like this: /start#botnameBot
as the creator of the group, check if the bot has the required permissions(telegram has introduced different types of permissions for admins/members of channel/group in version 4.1 )
despite of peer to peer conversations, you should send your message to chatID instead of sender's id
Related
I've been using a Telegram BOT to send notifications for a group, and for users.
I already know i can get Chat ID by receiving a message from the user on my bot, using getUpdates.
I also know i can get Group ID using the same method...
But what i really need is:
There is three users in my group.
My bot.
Me.
Another user that didn't sent any messages to my bot so it does not appear on getUpdates
Is it possible to get this third user his ID?
PS: I am the group owner, and also added my bot as Admin...
The third user is a normal user.
Can someone help me?
Thanks!
That's not possible with the offical Telegram Bot API
Possible Workarounds:
Hold a list of your own. If a user is joining (new_chat_member), lefting (left_chat_member), somebody is sending a message in the group, and so on. Check Message for more information.
Check if a user is a member of the group with getChatMember.
Also may be helpful: getChatMembersCount and getChatAdministrators
My friend has a tranding bot made with BotFather.
Is there a way to make the bot shared betweeen our account in a way we can use it together?
Bot usernames are unique to each Telegram account and only that account is able to change the settings of the bot.
But you can make use of a bot through its API_TOKEN which you can get from botfather.
It looks like this:
300123900:BARsAbMYBJv5wFhzNJ-Gbx678qpln7IgvzI
If you share the token with anyone, they can use your bot. They will receive an error if they try to use it at the same time (calling getUpdates method from more than one instance would reject the caller except for the first one).
If by sharing you meant using the bot (not developing it), you can't do that unless the bot's developer designs it in a way that multiple Telegram accounts messaging the bot are considered one account.
i'm trying to create a bot which can read/receive all messages in a specific channel and send them to me .
my problem here is that i can't find a way to access those messages in my bot
important thing is:
i'm not admin or creator of that channel
i don't want to ask the creator to add my bot as administrator
i've searched in google but i wasn't able to find a solution
and i'm also sure that it is possible to do it, because there are already some junction bots with exact same performance .
any references or suggestions are appreciated .
As already pointed out in the Telegram group of python-telegram-bot, bots can't receive messages from channels where they are not an admin. If you want something like this, you'll have to use a user bot, e.g. a program that controls your private Telegram account (in contrast to controlling a bot account). See here for some info on user bots.
Note that also the provider that you linked seems to be using userbots behind the scenes. More precisely, the docs on the so called "DirectConnection" state that you need to enter a phone number (associated to a telegram account) and then "Follow the instructions" which probably just means to enter the verification code that Telegram sends you. Phone number + verification code is exactly what is needed to control your private Telegram account.
Disclaimer: I'm currently the maintainer of python-telegram-bot.
I am using Telegram bot API with AWS Lambda and Zappa.
Everything was working fine. Until I realised that bot's webhook is being called everytime whenever a message is sent by anyone in the group.
I want to limit this webhook requests, as Lambda allows for only 1 million calls which is sufficient if bot is invoked, but only when /commands are called.
As I have to pin and edit messages using bot, that's why administrator permission is must.
I just want my bot to respond only to /commands along with administrator rights.
Please help me in tackling this issue.
I am assuming you added your bot to a Telegram group. In this case, the first thing that you need is group id. This should help: https://github.com/GabrielRF/telegram-id#web-group-id
And then you need to write a function that identifies the status of a chat member. You can do this using getChatMember method in Telegram Bots API.
If the chat member's status is "creator" or "administrator" then the response is sent to that user.
There are 2 things you need to do.
setPrivacy for your bot - go to BotFather chat and use the /setPrivacy command which gives you the ability to set:
'Enable' - your bot will only receive messages that either start with
the '/' symbol or mention the bot by username. (Should be default)
'Disable' - your bot
will receive all messages that people send to groups. Current status
is: DISABLED.
When setting the commands for the bot, set the BotCommandScopeAllChatAdministrators scope which should limit the use of the command only to the admins of the chat.
I have webhook a telegram bot for search data my a hosted
How can ignore positive chat I'd by bot I have a bot to search files from my hosted data And get link using telegram I want that bot just work in groups only If any person try to use it in personal chat it will not give reply means not search data and not give a link
Every message has a chat field and each chat has a type see telegram bot api
Type of chat, can be either “private”, “group”, “supergroup” or
“channel”
check if type of chat of message is equal to “group” or “supergroup” then do what you want.
In php can check like below
if($message->chat->type == "group")
...
Can you clear before using this command
if($message->chat->type == "group")
Need other commands in header
Or full command please