Module telegram-bot-lua.helpers

helper methods for common telegram bot operations.

Functions

api.get_chat_member_permissions(chat_id, user_id) get the permissions of a chat member as a normalised table.
api.has_user_left(chat_id, user_id) check if a user has left a chat.
api.is_user_group_admin(chat_id, user_id) check if a user is an administrator or creator in a chat.
api.is_user_group_creator(chat_id, user_id) check if a user is the creator of a chat.
api.is_user_kicked(chat_id, user_id) check if a user has been kicked (banned) from a chat.
api.is_user_restricted(chat_id, user_id) check if a user is restricted in a chat.


Functions

api.get_chat_member_permissions(chat_id, user_id)
get the permissions of a chat member as a normalised table. returns a table with boolean values for each permission, defaulting to false.

Parameters:

  • chat_id number|string unique identifier for the target chat
  • user_id number unique identifier of the target user

Returns:

    table|boolean permissions table, or false on failure
api.has_user_left(chat_id, user_id)
check if a user has left a chat.

Parameters:

  • chat_id number|string unique identifier for the target chat
  • user_id number unique identifier of the target user

Returns:

  1. boolean true if the user has left
  2. string|number the HTTP status or the user's actual status
api.is_user_group_admin(chat_id, user_id)
check if a user is an administrator or creator in a chat.

Parameters:

  • chat_id number|string unique identifier for the target chat
  • user_id number unique identifier of the target user

Returns:

  1. boolean true if the user is an admin or creator
  2. string|number the HTTP status or the user's actual status
api.is_user_group_creator(chat_id, user_id)
check if a user is the creator of a chat.

Parameters:

  • chat_id number|string unique identifier for the target chat
  • user_id number unique identifier of the target user

Returns:

  1. boolean true if the user is the creator
  2. string|number the HTTP status or the user's actual status
api.is_user_kicked(chat_id, user_id)
check if a user has been kicked (banned) from a chat.

Parameters:

  • chat_id number|string unique identifier for the target chat
  • user_id number unique identifier of the target user

Returns:

  1. boolean true if the user is kicked
  2. string|number the HTTP status or the user's actual status
api.is_user_restricted(chat_id, user_id)
check if a user is restricted in a chat.

Parameters:

  • chat_id number|string unique identifier for the target chat
  • user_id number unique identifier of the target user

Returns:

  1. boolean true if the user is restricted
  2. string|number the HTTP status or the user's actual status
generated by LDoc 1.5.0 Last updated 2026-04-07 21:37:15