Is that possible a telegram bot can remove messages from group - telegram-bot

i want create telegram bot .
It can join to the group and delete messages in group .
Is that possible a telegram bot can remove messages from group ?
i search and some people say yes it possible , some people say no

Check this link out, it seems the new bot API made it possible with some restrictions:
https://core.telegram.org/bots/api#deletemessage
The following details are from telegram API page:
A message can only be deleted if it was sent less than 48 hours ago.
Bots can delete outgoing messages in groups and supergroups.
Bots granted can_post_messages permissions can delete outgoing messages in channels.
If the bot is an administrator of a group, it can delete any message there.
If the bot has can_delete_messages permission in a supergroup or a channel, it can delete any message there.
Returns True on success.

This is now outdated, please see Darkc0d3r's answer
Using the Telegram Bot API? No, there is no such functionality as of now.
However you can if you are using the Telegram API, where you can use the messages.deleteMessages method, which requires you to give it a list of message id's as a parameter.

You can use
bot.DeleteMessageAsync(chatId, messageId)
you should make it in a try catch in case the message doesn't exist anymore or you have a wrong messageId,
messageId is a property which you get in MessageEventArgs.Message,
Note: the chatId should be the Group/Channel chatId and not of the user who sent it, get that in Chat.Id property of MessageEventArgs.Message ...

Related

Telegram Super Group Moderation

I'm looking for a telegram bot that will allow the admins or group moderators to first approve a message before the message is released to the greater group. Admins or moderators should be able to either approve or decline a message sent by a user of a group that way to keep control of messages and content of the group ?
Telegram is not made use of this, I think this is impossible.
You can try allow any message in group, and if admin approved, bot forward it to channel.
What about scrabbling the message posted by the users so when user sends message to group other users can't read it but only admins can read it and have to type password to open and read message ?

How to know if user has seen a message sent by my bot in Telegram?

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

Send message to th all of bots users (telegram api)

how to send Send message to the all of bots users?
There is no way to sned message to all ?
what is the method name ?
From Official API FAQ:
How can I message all of my bot's subscribers at once?
Unfortunately, at this moment we don't have methods for sending bulk messages, e.g. notifications. We may add something along these lines in the future. (...)
Obviously, if you store users chat_id, you can send individual message to all users (I use this method).
Navid wants to send message to all subscribers via bot.
If subscribers are more than 100 persons bot will very slow to sending all messages and may doesn't send messages to all.
Navid's question was how we can send message without this problem?
you can send with curl_multi_exec
Currently, a developer would need to implement a special broadcasting function that would send the message to each active user at the time adding a small delay to avoid hitting the rate limit of 30 messages per second (see https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once). This would mean that a very popular bot with say 10K active users cannot give timely notification as the last user would get the message about 5 minutes after the first user.
Here is a feature request to ask to add a method in the Bot API to broadcast a message to all its active users at once. You can upvote this feature request. https://bugs.telegram.org/c/8463

can Telegram Bot sends message to group?

I create a group on Telegram and created a bot and add in.
I am trying to send a message to group that I created and the error shown as below
{"ok":false,"error_code":403,"description":"[Error]: Forbidden: can't write to chat with deleted user"}
I have use getUpdates from Bot Documents and managed to get chat id and doesn't work again for me. p2p (private type message) works for me but not group type.
Any advice please? Thank you.
Yes you can, you have to invite the bot into the group, grab the chat_id of the group and send the message as you are sending a normal message to a private user.
The error message is self-explanatory tough.

How can I send message to specific chatID?

I have chatId and want send messages while execute some tasks from java code. I found this explain on telegram "Bots can't initiate conversations with users. A user must either add them to a group or send them a message first. People can use telegram.me/ links or username search to find your bot." But my task works good when I use https request directly from browser. My bot perfectly answer for requests but how I can do this without user request?
I can not truly understand your case!
Anyway, your bot can send a message to a chat ID Only if the user witch blongs to the specified chat ID added your bot (send start to a bot).
and if it happened then send your message with
/sendMessage