Skip to content

createNewGroupChat

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

Creates new group chat and send corresponding messageGroupChatCreate, returns created chat.
Need at least two users to create a group.

createNewGroupChat(user_ids, title)
Option Description
user_ids Identifiers of users to add to the group.
title Title of new group chat, 0-255 characters.

Example

Create a group titled "Test Group" and add 194211431 and 345829823 as its members.

createNewGroupChat({[0] = 194211431, 345829823}, "Test Group")

Response:

{
  ID = "Chat",
  draft_message_ = false,
  id_ = -240919302,
  last_read_inbox_message_id_ = 0,
  last_read_outbox_message_id_ = "16032727040",
  notification_settings_ = {
    ID = "NotificationSettings",
    mute_for_ = 0,
    show_preview_ = true,
    sound_ = "default"
  },
  order_ = "6429537858536618938",
  photo_ = false,
  reply_markup_message_id_ = 0,
  title_ = "Test Group",
  top_message_ = {
    ID = "Message",
    can_be_deleted_ = true,
    can_be_edited_ = false,
    chat_id_ = -240919302,
    content_ = {
      ID = "MessageGroupChatCreate",
      members_ = {
        {
          ID = "User",
          first_name_ = "TGramIndoBot",
          foreign_link_ = {
            ID = "LinkStateNone"
          },
          have_access_ = true,
          id_ = 345829823,
          is_verified_ = false,
          last_name_ = false,
          my_link_ = {
            ID = "LinkStateNone"
          },
          phone_number_ = false,
          profile_photo_ = {
            ID = "ProfilePhoto",
            big_ = {
              ID = "File",
              id_ = 6,
              path_ = false,
              persistent_id_ = "AQADBQADracxG7_xnBQACDogyjIABJzknFpfrOy6LDYEAAEC",
              size_ = 0
            },
            id_ = "1485327780222707629",
            small_ = {
              ID = "File",
              id_ = 5,
              path_ = false,
              persistent_id_ = "AQADBQADracxG7_xnBQACDogyjIABC2rpiTmP3NIKjYEAAEC",
              size_ = 0
            }
          },
          restriction_reason_ = false,
          status_ = {
            ID = "UserStatusEmpty"
          },
          type_ = {
            ID = "UserTypeBot",
            can_join_group_chats_ = true,
            can_read_all_group_chat_messages_ = false,
            inline_query_placeholder_ = "Perintah...",
            is_inline_ = true,
            need_location_ = false
          },
          username_ = "tgramindobot"
        },
        [0] = {
          ID = "User",
          first_name_ = "Abon",
          foreign_link_ = {
            ID = "LinkStateKnowsPhoneNumber"
          },
          have_access_ = true,
          id_ = 194211431,
          is_verified_ = false,
          last_name_ = "Ketimus",
          my_link_ = {
            ID = "LinkStateKnowsPhoneNumber"
          },
          phone_number_ = "REDACTED",
          profile_photo_ = {
            ID = "ProfilePhoto",
            big_ = {
              ID = "File",
              id_ = 2,
              path_ = false,
              persistent_id_ = "AQADBQADW6gxG2dukwsACBVQyjIABC8HS8ezO2hr1XkDAAEC",
              size_ = 0
            },
            id_ = "834131745110599771",
            small_ = {
              ID = "File",
              id_ = 1,
              path_ = false,
              persistent_id_ = "AQADBQADW6gxG2dukwsACBVQyjIABAt-RZr5h2xE03kDAAEC",
              size_ = 0
            }
          },
          restriction_reason_ = false,
          status_ = {
            ID = "UserStatusOnline",
            expires_ = 1496993729
          },
          type_ = {
            ID = "UserTypeGeneral"
          },
          username_ = false
        }
      },
      title_ = "Test Group"
    },
    date_ = 1496993438,
    edit_date_ = 0,
    forward_info_ = false,
    id_ = "16032727040",
    is_post_ = false,
    reply_markup_ = false,
    reply_to_message_id_ = 0,
    send_state_ = {
      ID = "MessageIsSuccessfullySent"
    },
    sender_user_id_ = 194211431,
    ttl_ = 0,
    ttl_expires_in_ = 0,
    via_bot_user_id_ = 0,
    views_ = 0
  },
  type_ = {
    ID = "GroupChatInfo",
    group_ = {
      ID = "Group",
      anyone_can_edit_ = true,
      id_ = 240919302,
      is_active_ = true,
      member_count_ = 2,
      migrated_to_channel_id_ = 0,
      status_ = {
        ID = "ChatMemberStatusCreator"
      }
    }
  },
  unread_count_ = 0
}

Test script
Frequently Asked Questions
The Functions

Clone this wiki locally