Skip to content

searchPublicChat

Sahri Riza Umami edited this page Jun 21, 2017 · 5 revisions

Searches public chat by its username.

searchPublicChat(username)

Currently only private and channel chats can be public.
Returns chat if found, otherwise some error is returned.

Option Description
username Username to be resolved.

Example

  • Search for @pegelinux public chat.

    searchPublicChat("pegelinux")

    Response:

    {
      ID = "Chat",
      draft_message_ = false,
      id_ = "-1001006631380",
      last_read_inbox_message_id_ = 0,
      last_read_outbox_message_id_ = "2251799812636672",
      notification_settings_ = {
        ID = "NotificationSettings",
        mute_for_ = 0,
        show_preview_ = true,
        sound_ = "default"
      },
      order_ = 0,
      photo_ = {
        ID = "ChatPhoto",
        big_ = {
          ID = "File",
          id_ = 1197,
          path_ = false,
          persistent_id_ = "AQADBQATsqSzMgAE7eZdl_eysrucuAACAg",
          size_ = 0
        },
        small_ = {
          ID = "File",
          id_ = 1196,
          path_ = false,
          persistent_id_ = "AQADBQATsqSzMgAENU-VoIkTIjqauAACAg",
          size_ = 0
        }
      },
      reply_markup_message_id_ = 0,
      title_ = "kabayankababayan",
      top_message_ = {
        ID = "Message",
        can_be_deleted_ = false,
        can_be_edited_ = false,
        chat_id_ = "-1001006631380",
        content_ = {
          ID = "MessageText",
          entities_ = {
            [0] = {
              ID = "MessageEntityUrl",
              length_ = 25,
              offset_ = 0
            }
          },
          text_ = "https://t.me/botresources",
          web_page_ = {
            ID = "WebPage",
            animation_ = false,
            audio_ = false,
            author_ = false,
            description_ = "The catalogue for everythings about Telegram bot",
            display_url_ = "t.me/botresources",
            document_ = false,
            duration_ = 0,
            embed_height_ = 0,
            embed_type_ = false,
            embed_url_ = false,
            embed_width_ = 0,
            photo_ = {
              ID = "Photo",
              has_stickers_ = false,
              id_ = "1594437868144666543",
              sizes_ = {
                {
                  ID = "PhotoSize",
                  height_ = 320,
                  photo_ = {
                    ID = "File",
                    id_ = 1199,
                    path_ = false,
                    persistent_id_ = "AgADBQADr6cxG8uUIBZEAbJkW429JmNEyjIABKG05BiKJEPDigABAwABAg",
                    size_ = 17356
                  },
                  type_ = "b",
                  width_ = 320
                },
                {
                  ID = "PhotoSize",
                  height_ = 640,
                  photo_ = {
                    ID = "File",
                    id_ = 1200,
                    path_ = false,
                    persistent_id_ = "AgADBQADr6cxG8uUIBZEAbJkW429JmNEyjIABM29ENhhSd5ZiwABAwABAg",
                    size_ = 42934
                  },
                  type_ = "c",
                  width_ = 640
                },
                [0] = {
                  ID = "PhotoSize",
                  height_ = 160,
                  photo_ = {
                    ID = "File",
                    id_ = 1198,
                    path_ = false,
                    persistent_id_ = "AgADBQADr6cxG8uUIBZEAbJkW429JmNEyjIABAmv0DHWNv6viQABAwABAg",
                    size_ = 7613
                  },
                  type_ = "a",
                  width_ = 160
                }
              }
            },
            site_name_ = "Telegram",
            sticker_ = false,
            title_ = "Telegram Bot Resources",
            type_ = "article",
            url_ = "https://t.me/botresources",
            video_ = false,
            voice_ = false
          }
        },
        date_ = 1497086263,
        edit_date_ = 0,
        forward_info_ = false,
        id_ = 147849216,
        is_post_ = true,
        reply_markup_ = false,
        reply_to_message_id_ = 0,
        send_state_ = {
          ID = "MessageIsIncoming"
        },
        sender_user_id_ = 0,
        ttl_ = 0,
        ttl_expires_in_ = 0,
        via_bot_user_id_ = 0,
        views_ = 95
      },
      type_ = {
        ID = "ChannelChatInfo",
        channel_ = {
          ID = "Channel",
          anyone_can_invite_ = false,
          date_ = 1497538069,
          id_ = 1006631380,
          is_supergroup_ = false,
          is_verified_ = false,
          restriction_reason_ = false,
          sign_messages_ = false,
          status_ = {
            ID = "ChatMemberStatusLeft"
          },
          username_ = "pegelinux"
        }
      },
      unread_count_ = 0
    }

Test script
Frequently Asked Questions
The Functions

Clone this wiki locally