Link Search Menu Expand Document

danog\MadelineProto\EventHandler\Message\GroupMessage

Back to index

Author: Daniil Gentili daniil@daniil.it

Represents an incoming or outgoing group message.

Properties

  • $message: string Content of the message
  • $fwdInfo: ?\danog\MadelineProto\EventHandler\ForwardedInfo Info about a forwarded message
  • $command: ?string Bot command (if present)
  • $commandType: ?\danog\MadelineProto\EventHandler\CommandType Bot command type (if present)
  • $commandArgs: list<string> Bot command arguments (if present)
  • $protected: bool Whether this message is protected
  • $matches: list<string> Regex matches, if a filter regex is present
  • $media: \danog\MadelineProto\EventHandler\Media\Audio|\danog\MadelineProto\EventHandler\Media\Document|\danog\MadelineProto\EventHandler\Media\DocumentPhoto|\danog\MadelineProto\EventHandler\Media\Gif|\danog\MadelineProto\EventHandler\Media\MaskSticker|\danog\MadelineProto\EventHandler\Media\Photo|\danog\MadelineProto\EventHandler\Media\RoundVideo|\danog\MadelineProto\EventHandler\Media\Sticker|\danog\MadelineProto\EventHandler\Media\Video|\danog\MadelineProto\EventHandler\Media\Voice|null Attached media.
  • $fromScheduled: bool Whether this message is a sent scheduled message
  • $viaBotId: ?int If the message was generated by an inline query, ID of the bot that generated it
  • $editDate: ?int Last edit date of the message
  • $keyboard: \danog\MadelineProto\EventHandler\Keyboard\InlineKeyboard|\danog\MadelineProto\EventHandler\Keyboard\ReplyKeyboard|null Inline or reply keyboard.
  • $imported: bool Whether this message was imported from a foreign chat service
  • $psaType: ?string For Public Service Announcement messages, the PSA type
  • $nextSent: ?self @readonly For sent messages, contains the next message in the chain if the original message had to be split.
  • $views: ?int View counter for messages from channels or forwarded from channels
  • $forwards: ?int Forward counter for messages from channels or forwarded from channels
  • $signature: ?string Author of the post, if signatures are enabled for messages from channels or forwarded from channels
  • $entities: list<\MessageEntity> Message entities for styled text
  • $id: int Message ID
  • $out: bool Whether the message is outgoing
  • $chatId: int ID of the chat where the message was sent
  • $senderId: int ID of the sender of the message
  • $replyToMsgId: ?int ID of the message to which this message is replying
  • $date: int When was the message sent
  • $topicId: ?int ID of the forum topic where the message was sent
  • $threadId: ?int ID of the message thread where the message was sent
  • $replyToScheduled: bool Whether this is a reply to a scheduled message
  • $mentioned: bool Whether we were mentioned in this message
  • $silent: bool Whether this message was sent without any notification (silently)
  • $ttlPeriod: ?int Time-to-live of the message

Method list:

Methods:

getMember(string|int|null $member = NULL): \danog\MadelineProto\EventHandler\Participant

Get info about a channel/supergroup participant.

Parameters:

  • $member: string|int|null Participant to get info about; can be empty or null to get info about the sender of the message.

See also:

hideMembers(): void

Hide the participants list in a supergroup. The supergroup must have at least hidden_members_group_size_min participants in order to use this method, as specified by the client configuration parameters ».

unhideMembers(): void

Display the participants list in a supergroup. The supergroup must have at least hidden_members_group_size_min participants in order to use this method, as specified by the client configuration parameters ».

hideHistory(): void

Hide message history for new supergroup users.

unhideHistory(): void

Unhide message history for new supergroup users.

ban(int $untilDate = 0): void

Ban message sender from current supergroup.

Parameters:

  • $untilDate: int Validity of said permissions (it is considered forever any value less then 30 seconds or more then 366 days).

unban(int $untilDate = 0): void

Unban message sender from current supergroup.

Parameters:

  • $untilDate: int Validity of said permissions (it is considered forever any value less then 30 seconds or more then 366 days).

kick(): void

Kick message sender from current supergroup.

deleteAll(bool $forEveryone = true, int $maxId = 0): void

Delete all supergroup message.

Parameters:

  • $forEveryone: bool
  • $maxId: int

deleteUserMessages(string|int|null $member = NULL): void

Delete all messages sent by a specific participant of a given supergroup.

Parameters:

  • $member: string|int|null The participant whose messages should be deleted, if null or absent defaults to the sender of the message.

toSuperGroup(): \int the channel id that migrate to

Turn a basic group into a supergroup.

Return value: the channel id that migrate to

enableAntiSpam(): void

Enable the native antispam system.

disableAntiSpam(): void

Disable the native antispam system.

enableTopics(): void

Enable forum functionality in a supergroup.

disableTopics(): void

Disable forum functionality in a supergroup.

createTopic(string $title, \danog\MadelineProto\EventHandler\Topic\IconColor|int $icon = \danog\MadelineProto\EventHandler\Topic\IconColor::NONE): \danog\MadelineProto\EventHandler\Message\Service\DialogTopicCreated

Create a forum topic; requires manage_topics rights.

Parameters:

  • $title: string Topic title (maximum UTF-8 length: 128)
  • $icon: \danog\MadelineProto\EventHandler\Topic\IconColor|int Icon color, or ID of the custom emoji used as topic icon. Telegram Premium users can use any custom emoji, other users can only use the custom emojis contained in the inputStickerSetEmojiDefaultTopicIcons emoji pack. If no custom emoji icon is specified, specifies the color of the fallback topic icon

See also:

editTopic(string $title, int $icon = 0, int|null $topicId = NULL): \danog\MadelineProto\EventHandler\Message\Service\DialogTopicEdited

Edit a forum topic; requires manage_topics rights.

Parameters:

  • $title: string Topic title (maximum UTF-8 length: 128)
  • $icon: int ID of the custom emoji used as topic icon. Telegram Premium users can use any custom emoji, other users can only use the custom emojis contained in the inputStickerSetEmojiDefaultTopicIcons emoji pack. Pass 0 to switch to the fallback topic icon.
  • $topicId: int|null Topic ID, if absent defaults to the topic where this message was sent.

See also:

openTopic(int|null $topicId = NULL): \danog\MadelineProto\EventHandler\Message\Service\DialogTopicEdited

Open a forum topic; requires manage_topics rights.

Parameters:

  • $topicId: int|null Topic ID, if absent defaults to the topic where this message was sent.

See also:

closeTopic(int|null $topicId = NULL): \danog\MadelineProto\EventHandler\Message\Service\DialogTopicEdited

Close a forum topic; requires manage_topics rights.

Parameters:

  • $topicId: int|null Topic ID, if absent defaults to the topic where this message was sent.

See also:

deleteTopic(int|null $topicId = NULL): void

Delete message history of a forum topic.

Parameters:

  • $topicId: int|null Topic ID, if absent defaults to the topic where this message was sent.

pin(bool $pmOneside = false, bool $silent = false): void

Pin a message.

Parameters:

  • $pmOneside: bool Whether the message should only be pinned on the local side of a one-to-one chat
  • $silent: bool Pin the message silently, without triggering a notification

unpin(bool $pmOneside = false, bool $silent = false): ?\danog\MadelineProto\EventHandler\Update

Unpin a message.

Parameters:

  • $pmOneside: bool Whether the message should only be pinned on the local side of a one-to-one chat
  • $silent: bool Pin the message silently, without triggering a notification

See also:

getOurReactions(): list<string|int>

Get our reactions on the message.

report(\danog\MadelineProto\EventHandler\Message\ReportReason $reason, string $message): bool

Report a message in a chat for violation of telegram’s Terms of Service.

Parameters:

  • $reason: \danog\MadelineProto\EventHandler\Message\ReportReason Why are these messages being reported
  • $message: string Comment for report moderation

See also:

saveContact(string $firstName, string|null $lastName = NULL, string|null $phoneNumber = NULL, bool $addPhonePrivacyException = false): void

Save message sender to your account contacts.

Parameters:

  • $firstName: string First name
  • $lastName: string|null Last name
  • $phoneNumber: string|null Telegram ID of the other user
  • $addPhonePrivacyException: bool Allow the other user to see our phone number?

removeContact(): void

Remove message sender from your account contacts.

inviteToChannel(string|int $channel): void

Invite message sender to requested channel.

Parameters:

  • $channel: string|int Username, Channel ID

addReaction(string|int $reaction, bool $big = false, bool $addToRecent = true): list<string|int>

Add reaction to message.

Parameters:

  • $reaction: string|int reaction
  • $big: bool Whether a bigger and longer reaction should be shown
  • $addToRecent: bool Add this reaction to the recent reactions list.

delReaction(string|int $reaction): list<string|int>

Delete reaction from message.

Parameters:

  • $reaction: string|int string or int Reaction

translate(string $toLang): string

Translate text message(for media translate it caption).

Parameters:

  • $toLang: string Two-letter ISO 639-1 language code of the language to which the message is translated

editText(string $message, \danog\MadelineProto\ParseMode $parseMode = \danog\MadelineProto\ParseMode::TEXT, array|null $replyMarkup = NULL, int|null $scheduleDate = NULL, bool $noWebpage = false): \danog\MadelineProto\EventHandler\Message

Edit message text.

Parameters:

  • $message: string New message
  • $parseMode: \danog\MadelineProto\ParseMode Whether to parse HTML or Markdown markup in the message
  • $replyMarkup: array|null Reply markup for inline keyboards
  • $scheduleDate: int|null Scheduled message date for scheduled messages
  • $noWebpage: bool Disable webpage preview

See also:

getHTML(bool $allowTelegramTags = false): string

Get an HTML version of the message.

Parameters:

  • $allowTelegramTags: bool Whether to allow telegram-specific tags like tg-spoiler, tg-emoji, mention links and so on…

isReply(): bool

Check if the current message replies to another message.

getReply(class-string<\T> $class = 'danog\\MadelineProto\\EventHandler\\AbstractMessage'): ?\T

Get replied-to message. May return null if the replied-to message was deleted or if the message does not reply to any other message.

Parameters:

  • $class: class-string<\T> Only return a reply if it is of the specified type, return null otherwise.

See also:

  • \T

delete(bool $revoke = true): void

Delete the message.

Parameters:

  • $revoke: bool Whether to delete the message for all participants of the chat.

reply(string $message, \danog\MadelineProto\ParseMode $parseMode = \danog\MadelineProto\ParseMode::TEXT, array|null $replyMarkup = NULL, int|null $sendAs = NULL, int|null $scheduleDate = NULL, bool $noWebpage = false, bool $silent = false, bool $noForwards = false, bool $background = false, bool $clearDraft = false, bool $updateStickersetsOrder = false): \danog\MadelineProto\EventHandler\Message

Reply to the message.

Parameters:

  • $message: string Message to send
  • $parseMode: \danog\MadelineProto\ParseMode Parse mode
  • $replyMarkup: array|null Keyboard information.
  • $sendAs: int|null Peer to send the message as.
  • $scheduleDate: int|null Schedule date.
  • $noWebpage: bool Set this flag to disable generation of the webpage preview
  • $silent: bool Whether to send the message silently, without triggering notifications.
  • $noForwards: bool
  • $background: bool Send this message as background message
  • $clearDraft: bool Clears the draft field
  • $updateStickersetsOrder: bool Whether to move used stickersets to top

See also:

block(): bool

Adds the user to the blacklist.

unblock(): bool

Deletes the user from the blacklist.

getStories(): list<\danog\MadelineProto\EventHandler\AbstractStory>

Get user stories.

See also:

setAction(\danog\MadelineProto\EventHandler\Action $action = \danog\MadelineProto\EventHandler\Action\Typing::__set_state(array(]]): bool

Sends a current user typing event (see SendMessageAction for all event types) to a conversation partner or group.

Parameters:

  • $action: \danog\MadelineProto\EventHandler\Action

See also:

read(bool $readAll = false): \bool if set, read all messages in current chat.

Mark selected message as read.

Parameters:

  • $readAll: bool

Return value: if set, read all messages in current chat.

enableTTL(int $seconds = 86400): \danog\MadelineProto\EventHandler\Message\Service\DialogSetTTL

Set maximum Time-To-Live of all messages in the specified chat.

Parameters:

  • $seconds: int Automatically delete all messages sent in the chat after this many seconds

See also:

disableTTL(): \danog\MadelineProto\EventHandler\Message\Service\DialogSetTTL

Disable Time-To-Live of all messages in the specified chat.

See also:


Generated by danog/phpdoc