Comments (9)
A bot can remove messages https://stackoverflow.com/a/45285278/5457433 from groups and receive leave/join notifications ... not sure about service messages. It shouldn't be hard to set it up e.g. a bot that deletes all messages. I'll give it a shot.
from telegram.
php-telegram-bot/core#730 I am reffering to this , I am not sure about PHP though
from telegram.
Join/left messages are bundled in fields containing the users in Message
.
Please try this, couldn't test it, but should work or be very close.
import info.mukel.telegrambot4s.api._
import info.mukel.telegrambot4s.methods._
import info.mukel.telegrambot4s.models._
/**
* Remove join/left messages from groups.
*/
object GroupBot extends TelegramBot
with Polling {
lazy val token = "TOKEN"
override def receiveMessage(msg: Message): Unit = {
super.receiveMessage(msg)
if (msg.newChatMembers.isDefined || msg.leftChatMember.isDefined)
request(DeleteMessage(msg.source, msg.messageId))
}
}
GroupBot.run()
from telegram.
Thanks It worked , but only for single group ,when I added the bot in two group it tarted throwing me this error .
ERROR info.mukel.telegrambot4s.clients.AkkaClient - Telegram API exception
info.mukel.telegrambot4s.api.TelegramApiException: Bad Request: message can't be deleted
at info.mukel.telegrambot4s.clients.AkkaClient.$anonfun$apply$3(AkkaClient.scala:56)
at scala.concurrent.Future.$anonfun$flatMap$1(Future.scala:302)
at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:37)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:60)
at scala.concurrent.impl.ExecutionContextImpl$AdaptedForkJoinTask.exec(ExecutionContextImpl.scala:140)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.pollAndExecAll(ForkJoinPool.java:1021)
at java.util.concurrent.ForkJoinPool$WorkQueue.execLocalTasks(ForkJoinPool.java:1046)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1058)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
from telegram.
It seems like a permission issue. The bot must be admin or have permission to delete messages.
https://core.telegram.org/bots/api#deletemessage
from telegram.
Any updates on this?
from telegram.
works perfect after giving permission.
from telegram.
hi . my bot delete the join and left service messages in my group but speed of deleting is so slow . when i add 50 person in one action with telegraph 50 service message apear in room and about 30 seconds for delete this 50 service messages with bot . my bot writen in php . see my code please . can you help me for solve this problem ? thanks
from telegram.
@$newmember = $result->message->new_chat_member->id;
@$leftmember = $result->message->left_chat_member->id;
@$gpid = $result->message->chat->id;
@$messageid = $result->message->message_id;
$telegram = new telegram(TOKEN,HOST,USERNAME,PASSWORD,DBNAME);
if(!empty($newmember)|| !empty($leftmember)){
$telegram->deleteMessage($gpid,$messageid);
die();
}
from telegram.
Related Issues (20)
- Bot silently stops receiving updates when it gets a message that fails to parse HOT 9
- Remove okhttp dependency from "core" module HOT 1
- Example on how to use `SetMyCommands` HOT 6
- Add `FilterF` and declarative `whenF`
- Support bot API v6
- SSL error: 0A00010B:SSL routines::wrong version number HOT 10
- Support 6.1 API
- SSL with ZIO Webhook using asyncHttpClient HOT 16
- Help to remove menu. HOT 1
- Support underscore in command name HOT 2
- No reconnect on connecton issues HOT 5
- Proxy basic authentification HOT 2
- requirement failed: Exactly one of the optional fields should be used HOT 2
- scala.MatchError on EditMessageMedia HOT 2
- Monetstore and cryptocurrency, services and advertising/marketing Ltd
- Victormonet
- Migrate to Pekko HOT 1
- Bezzi
- Scala 3
- Java 21
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from telegram.