Module telegram-bot-lua.methods.members

members API methods.

Functions

api.ban_chat_member(chat_id, user_id, opts) ban a user from a chat.
api.ban_chat_sender_chat(chat_id, sender_chat_id) ban a channel chat in a supergroup or channel.
api.get_user_profile_audios(user_id, opts) get a list of profile audios for a user.
api.get_user_profile_photos(user_id, opts) get a list of profile pictures for a user.
api.promote_chat_member(chat_id, user_id, opts) promote or demote a user in a supergroup or channel.
api.restrict_chat_member(chat_id, user_id, permissions, opts) restrict a user in a supergroup.
api.set_chat_administrator_custom_title(chat_id, user_id, custom_title) set a custom title for an administrator in a supergroup promoted by the bot.
api.set_chat_member_tag(chat_id, user_id, opts) set the tag of a chat member.
api.unban_chat_member(chat_id, user_id, opts) unban a previously banned user in a supergroup or channel.
api.unban_chat_sender_chat(chat_id, sender_chat_id) unban a previously banned channel chat in a supergroup or channel.


Functions

api.ban_chat_member(chat_id, user_id, opts)
ban a user from a chat.

Parameters:

  • chat_id number|string unique identifier for the target chat or username of the target supergroup/channel
  • user_id number unique identifier of the target user
  • opts table optional parameters
    • until_date number date when the user will be unbanned (unix timestamp)
    • revoke_messages boolean pass true to delete all messages from the chat for the user

Returns:

    table,number the response object and HTTP status
api.ban_chat_sender_chat(chat_id, sender_chat_id)
ban a channel chat in a supergroup or channel.

Parameters:

  • chat_id number|string unique identifier for the target chat or username of the target supergroup/channel
  • sender_chat_id number unique identifier of the target sender chat

Returns:

    table,number the response object and HTTP status
api.get_user_profile_audios(user_id, opts)
get a list of profile audios for a user.

Parameters:

  • user_id number unique identifier of the target user
  • opts table optional parameters
    • offset number sequential number of the first audio to be returned
    • limit number limits the number of audios to be retrieved

Returns:

    table,number the response object and HTTP status
api.get_user_profile_photos(user_id, opts)
get a list of profile pictures for a user.

Parameters:

  • user_id number unique identifier of the target user
  • opts table optional parameters
    • offset number sequential number of the first photo to be returned
    • limit number limits the number of photos to be retrieved (1-100)

Returns:

    table,number the response object and HTTP status
api.promote_chat_member(chat_id, user_id, opts)
promote or demote a user in a supergroup or channel.

Parameters:

  • chat_id number|string unique identifier for the target chat or username of the target supergroup/channel
  • user_id number unique identifier of the target user
  • opts table optional parameters
    • is_anonymous boolean pass true if the administrator's presence in the chat is hidden
    • can_manage_chat boolean pass true if the administrator can manage the chat
    • can_delete_messages boolean pass true if the administrator can delete messages
    • can_restrict_members boolean pass true if the administrator can restrict members
    • can_promote_members boolean pass true if the administrator can promote members

Returns:

    table,number the response object and HTTP status
api.restrict_chat_member(chat_id, user_id, permissions, opts)
restrict a user in a supergroup.

Parameters:

  • chat_id number|string unique identifier for the target chat or username of the target supergroup
  • user_id number unique identifier of the target user
  • permissions table|string a JSON-serialized object for new user permissions
  • opts table optional parameters
    • use_independent_chat_permissions boolean pass true if chat permissions are set independently
    • until_date number date when restrictions will be lifted (unix timestamp)

Returns:

    table,number the response object and HTTP status
api.set_chat_administrator_custom_title(chat_id, user_id, custom_title)
set a custom title for an administrator in a supergroup promoted by the bot. truncated to 16 characters.

Parameters:

  • chat_id number|string unique identifier for the target chat or username of the target supergroup
  • user_id number unique identifier of the target user
  • custom_title string new custom title for the administrator (max 16 characters)

Returns:

    table,number the response object and HTTP status
api.set_chat_member_tag(chat_id, user_id, opts)
set the tag of a chat member.

Parameters:

  • chat_id number|string unique identifier for the target chat or username of the target supergroup
  • user_id number unique identifier of the target user
  • opts table optional parameters
    • tag string the tag to assign to the member

Returns:

    table,number the response object and HTTP status
api.unban_chat_member(chat_id, user_id, opts)
unban a previously banned user in a supergroup or channel.

Parameters:

  • chat_id number|string unique identifier for the target chat or username of the target supergroup/channel
  • user_id number unique identifier of the target user
  • opts table optional parameters
    • only_if_banned boolean do nothing if the user is not banned

Returns:

    table,number the response object and HTTP status
api.unban_chat_sender_chat(chat_id, sender_chat_id)
unban a previously banned channel chat in a supergroup or channel.

Parameters:

  • chat_id number|string unique identifier for the target chat or username of the target supergroup/channel
  • sender_chat_id number unique identifier of the target sender chat

Returns:

    table,number the response object and HTTP status
generated by LDoc 1.5.0 Last updated 2026-04-07 21:37:15