I created quite nice bot for telegram but facing now some issues with security. I want my bot to work only in certain group which i allow ( already done by group_id) but i want also to block option to write to my bot in private message. I could block adding to groups from BotFather options but still people can write to him in private messages.
I tried to use function when someone write to him:
bot.leave_chat(message.chat.id)
But bot still don't want to leave private conversation with people. How could I prevent in this or other way from adding my bot or trying to flood him with requests?
Technically it's not possible to forbid people to write messages directly to a Bot:
All bots, regardless of settings, will receive:
All service messages.
All messages from private chats with users.
All messages from channels where they are a member.
As per your question, I'd suggest to create a simple stub reply for private chats something like This Bot doesn't answer in private.
Leaving a chat might not "explain" people anything. I guess it rather will push them to try again and again, because it's not clear "Why bot disappears with no reason" ;)
Related
We have a bot on Google Chat but it seems people use it in the personal scope rather than adding to rooms. As per my understanding, there is no concept of "teams" on Google Chat. However, our bot works best with teams, ie, in rooms.
Is there a way to ensure bot is added to rooms? Also, to other bot developers out there - have you managed to replicate the success of Slack/MS Teams bots to Google Chat?
Thanks
There is no way to "force" users to use your bot in this way.
The best you could do is to detect whether the bot is in a private conversation and notify the user that it is useful as a "room" bot, not a "personal" bot. That and make sure your bot is well documented with the relevant info in hard-to-miss places.
You could do this by examining the event object which has this attribute:
space | object (Space) | The room or DM in which the event occurred.
Docs
Event Object - where you might find info related to where the bot was called from.
General Guides - for general info.
I am running a business regarding selling/buying online things and I am mainly using Discord to contact my suppliers/clients. It grew quite tiresome to manually send private messages to each one of my suppliers, and to organize contacts with the current discord interface (outside of specific servers)
What I am interested in is: can I create a script that, when I run it, would send a private message to multiple people in my friends list (being given a list of discord names), WITHOUT using a discord server? The server/channel option is not viable for me, nor is using another app. I would start building that in any programming language, I am just interested if it's possible as I have found no information regarding it.
Unfortunately, Discord Accounts can only message other accounts that they're either in a server with or are friends with. Discord Bots can't add friends, and if they were in a server with all of your clients that would defeat the purpose. A hypothetical solution would be to invite all of them to a Discord Server with no text channels and then have the bot message them from there, which is 100% possible and would be really easy to do.
I created a new Telegram Bot which maintains a simple list. When I chat with the Bot directly (in PMs) the Bot works as intended.
I created this bot for a group of friends, so I added the bot to the group, and now, whenever I execute a command, the bot responds, but also repeats my command. Is there any way to avoid this behavior?
I am using the python-telegram-bot API and sending messages using update.message.reply_text('My message')
Is this just intended behavior or is there any way to avoid the bot repeating the sent command?
The bot only is replying message, not creating 2 messages.
You should use send_message.
I found the solution. Telegram API understands this as quoting, and is enabled in groups by default, disabled in private chats.
It can be disabled by using:
update.message.reply_text("message", quote=False)
We can get Telegram messages when they are complete and sent via long polling or webhooks, but is there a way to understand when the user has started typing?
I guess this is not a normal case for bots and I dont think there is a straight away method but could we fall back on the Telegram API for messaging apps for that?
Well, actually I found a solution in the current Bot API; inline queries. While they are not intended for this, inline queries send what the user types in to the bot in real-time, so you are alerted as soon as the first characters are typed in.
There is a way in Telegram Core API, named: updateUserTyping.
But there is not any way in Telegram Bot API yet (until today: 2016-10-17).
If you type or send a file to the bot during these processes you do not get any message from Telegram in your webhook, but it's possible they'll add a new feature to detect user typing in future Bot API updates.
I'm developing a Telegram bot, and I want to know whether a user, that has started a private chat with my bot, has seen a certain message sent by bot, and to know when has he seen it.
Is it possible to do so?
Thank you very much.
That's currently not possible.
I'm using this solution.
Create a channel specially for your bot
Let your robot send message from this channel to users, you can use forward method.
Now you can see how many users have seen your message
Telegram Bot API has limit functionality. There is absolutely no way to get message view count at the time of this comment.
Usually TDLib can be used instead of Telegram Bot. It is Telegram client library. You can use it directly or make it as services for BOT to call.
For example. use TdApi.GetMessage to get the message, and the returned message has field of interactionInfo which contains forwardCount or viewCount.
perhaps this answer help you :
in the end of your message place
link example : yoursite.com\checkvisit.php?id=1234
when user open message link automatic run for telegram ...
you can understand message was read
you must in checkvisit.php set to check db if id exist and not read set it to read
then id in db remove or disable
but this method simple - telegram must add 1 parameter to return this
sorry my english not good
it is not possible yet , you might want to search for Madeline bot