Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I need listen group messages #72

Closed
henggedaren opened this issue Sep 24, 2024 · 0 comments
Closed

I need listen group messages #72

henggedaren opened this issue Sep 24, 2024 · 0 comments

Comments

@henggedaren
Copy link

my bot set privacy mode:DISABLED
Commands/Group/GenericmessageCommand.php cannot listen for messages

`
public function execute(): ServerResponse
{
$message = $this->getMessage();
$chat = $message->getChat();
$chat_id = $chat->getId();
$user_id = $message->getFrom()->getId();
$message_type = $message->getType();
$data = ['chat_id' => $chat_id];

    if ($chat->isGroupChat() || $chat->isSuperGroup()) {
        
        $data['reply_to_message_id'] = $message->getMessageId();
    }
    $data['text'] = $message_type;
    Request::sendMessage($data);

    // Handle new chat members
    if ($message->getNewChatMembers()) {
        return $this->getTelegram()->executeCommand('newchatmembers');
    }

    // Handle left chat members
    if ($message->getLeftChatMember()) {
        return $this->getTelegram()->executeCommand('leftchatmember');
    }

    // The chat photo was changed
    if ($new_chat_photo = $message->getNewChatPhoto()) {
        // Whatever..
    }

    // The chat title was changed
    if ($new_chat_title = $message->getNewChatTitle()) {
        // Whatever...
    }

    // A message has been pinned
    if ($pinned_message = $message->getPinnedMessage()) {
        // Whatever...
    }

    return Request::emptyResponse();
}

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant