Hi!
Is it possible? I have a supergroup with invite link. I want the bot to delete all messages from none-admin users.
For example:
User writes "Hi everyone"
And bot delete message at once.
How should the command look like? Do I need to change the Request::sendMessage method in vendor?
Thanks you a lot!
In GenericmessageCommand you can check if the user is an admin, if not, delete the message:
(untested, but you get the idea)
$message = $this->getMessage();
$message_id = $message->getMessageId();
$chat_id = $message->getChat()->getId();
$user_id = $message->getFrom()->getId();
if (!$this->getTelegram()->isAdmin($user_id)) {
return Request::deleteMessage(compact('message_id', 'chat_id'));
}
@noplanman thank you a lot!
Most helpful comment
In
GenericmessageCommandyou can check if the user is an admin, if not, delete the message:(untested, but you get the idea)