Skip to content

searchPublicChat

Sahri Riza Umami edited this page Jul 1, 2018 · 5 revisions

Searches a public chat by its username.
Currently only private chats, supergroups and channels can be public.
Returns the chat if found; otherwise an error is returned.

searchPublicChat(username, callback, data)
Field Type Description
username string Username to be resolved.

Example

  • Searches channel "@pegelinux".

    searchPublicChat('pegelinux')

    Response:

    {
      ["@type"] = "chat",
      can_be_reported = true,
      client_data = "",
      id = "-1001006631380",
      is_pinned = false,
      last_message = {
        ["@type"] = "message",
        author_signature = "",
        can_be_deleted_for_all_users = true,
        can_be_deleted_only_for_self = false,
        can_be_edited = false,
        can_be_forwarded = true,
        chat_id = "-1001006631380",
        contains_unread_mention = false,
        content = {
          ["@type"] = "messageText",
          text = {
            ["@type"] = "formattedText",
            entities = {
              {
                ["@type"] = "textEntity",
                length = 21,
                offset = 0,
                type = {
                  ["@type"] = "textEntityTypeUrl"
                }
              }
            },
            text = "https://pegelinux.id/"
          }
        },
        date = 1530198593,
        edit_date = 0,
        id = 291504128,
        is_channel_post = true,
        is_outgoing = false,
        media_album_id = "0",
        reply_to_message_id = 0,
        sender_user_id = 0,
        ttl = 0,
        ttl_expires_in = 0,
        via_bot_user_id = 0,
        views = 62
      },
      last_read_inbox_message_id = 291504128,
      last_read_outbox_message_id = "2251799812636672",
      notification_settings = {
        ["@type"] = "notificationSettings",
        mute_for = 0,
        show_preview = true,
        sound = "default"
      },
      order = "0",
      photo = {
        ["@type"] = "chatPhoto",
        big = {
          ["@type"] = "file",
          expected_size = 0,
          id = 16,
          ["local"] = {
            ["@type"] = "localFile",
            can_be_deleted = false,
            can_be_downloaded = true,
            downloaded_prefix_size = 0,
            downloaded_size = 0,
            is_downloading_active = false,
            is_downloading_completed = false,
            path = ""
          },
          remote = {
            ["@type"] = "remoteFile",
            id = "AQADBQATsqSzMgAE7eZdl_eysrucuAACAg",
            is_uploading_active = false,
            is_uploading_completed = true,
            uploaded_size = 0
          },
          size = 0
        },
        small = {
          ["@type"] = "file",
          expected_size = 0,
          id = 15,
          ["local"] = {
            ["@type"] = "localFile",
            can_be_deleted = false,
            can_be_downloaded = true,
            downloaded_prefix_size = 0,
            downloaded_size = 0,
            is_downloading_active = false,
            is_downloading_completed = false,
            path = ""
          },
          remote = {
            ["@type"] = "remoteFile",
            id = "AQADBQATsqSzMgAENU-VoIkTIjqauAACAg",
            is_uploading_active = false,
            is_uploading_completed = true,
            uploaded_size = 0
          },
          size = 0
        }
      },
      reply_markup_message_id = 0,
      title = "kabayankababayan",
      type = {
        ["@type"] = "chatTypeSupergroup",
        is_channel = true,
        supergroup_id = 1006631380
      },
      unread_count = 0,
      unread_mention_count = 0
    }

Frequently Asked Questions
The Functions

Clone this wiki locally