chat property

Chat? get chat

The chat where the message was sent.

This tries to extract the chat from various update types and returns null if no chat information is available. The result is cached after the first access for better performance.

Implementation

Chat? get chat {
  if (!_chatCached) {
    _cachedChat =
        message?.chat ??
        editedMessage?.chat ??
        channelPost?.chat ??
        editedChannelPost?.chat ??
        callbackQuery?.message?.chat;
    _chatCached = true;
  }
  return _cachedChat;
}