Link Search Menu Expand Document

danog\MadelineProto\EventHandler\AbstractPrivateMessage

Back to index

Author: Daniil Gentili daniil@daniil.it

Represents a private or secret chat 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
  • $groupedId: ?int Group ID for albums.
  • $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:

screenShot(): \danog\MadelineProto\EventHandler\Message\Service\DialogScreenshotTaken

Notify the other user in a private chat that a screenshot of the chat was taken.

See also:

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:

replyOrEdit(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

If the message is outgoing, will edit the message’s text, otherwise will reply to the message.

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, ?\Amp\Cancellation $cancellation = NULL): \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
  • $cancellation: ?\Amp\Cancellation

See also:

sendText(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, ?\Amp\Cancellation $cancellation = NULL): \danog\MadelineProto\EventHandler\Message

Send a text 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
  • $cancellation: ?\Amp\Cancellation

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<\1, \max> $seconds = 86400): \danog\MadelineProto\EventHandler\Message\Service\DialogSetTTL

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

Parameters:

  • $seconds: int<\1, \max> 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:

enableAutoTranslate(): bool

Show the real-time chat translation popup for a certain chat.

disableAutoTranslate(): bool

Hide the real-time chat translation popup for a certain chat.


Generated by danog/phpdoc