Skip to content

Latest commit

 

History

History
152 lines (101 loc) · 3.06 KB

authentication.md

File metadata and controls

152 lines (101 loc) · 3.06 KB

Authentication

Check Status

  • Return user status
Auth::getStatus(int|string|null $user_id, int|string|null $chat_id)

  • If the specified person is the admin of the group, it returns true
Auth::isChatAdmin(int|string|null $user_id, int|string|null $chat_id)

  • If the specified person is the creator of the group, it returns true
Auth::isChatCreator(int|string|null $user_id, int|string|null $chat_id)

  • If the specified person is the member of the group, it returns true
Auth::isChatMember(int|string|null $user_id, int|string|null $chat_id)

  • If the specified person is the kicked of the group, it returns true
Auth::iskicked(int|string|null $user_id, int|string|null $chat_id)

  • If the specified person is the restricted of the group, it returns true
Auth::isRestricted(int|string|null $user_id, int|string|null $chat_id)

  • If the specified person is the left of the group, it returns true
Auth::isLeft(int|string|null $user_id, int|string|null $chat_id)

  • If the specified person is the admin of the bot, it returns true
Auth::isBotAdmin(int|string|null $user_id, int|string|null $chat_id)

  • If the specified person is the owner of the bot, it returns true
Auth::isBotOwner(int|string|null $user_id, int|string|null $chat_id)

  • Bot administrators and bot owners are those who are not admins or group owners, but have specific access to use the bot.
  • If the entries are null, the sender of the message is considered to be in the current group.

Note:

  1. The admin and owner of the bot are authenticate based on the default database structure, whose migration is present in the project by default.
  2. Follow Laragram rules for proper functioning, otherwise you must use personal authentication system.
  3. In the future, we will try to make this dynamic.
  • After you make a group member the bot admin or bot owner, you must save it in the database.
  • You can do this easily with the following functions:

Role

  • Add new BotAdmin
Role::addBotAdmin(int|string|null $user_id, int|string|null $chat_id)

  • Add new BotOwner
Role::addBotOwner(int|string|null $user_id, int|string|null $chat_id)

  • Remove BotAdmin or BotOwner
Role::removeRole(int|string|null $user_id, int|string|null $chat_id)

  • Set custom role
Role::setRole(string $role, int|string $user_id, int|null|string $chat_id)

Level

  • Set User Level
Level::setLevel(string|int $level, int|string|null $user_id, int|string|null $chat_id)

  • Remove User Level
Level::removeLevel(int|string|null $user_id, int|string|null $chat_id)

  • Get User Level
Level::userLevel(int|null|string $user_id = null, int|null|string $chat_id = null)

This structure works based on Eloquent, so install Eloquent first

  • Get Eloquent
php laragram install:eloqunet