0xwaleed/discorole
Composer 安装命令:
composer require 0xwaleed/discorole
包简介
Check user's roles and permissions
README 文档
README
DiscoRole
Simple PHP library to get all user's rols and permissions from the specified guild.
The Purpose
Sometimes I build an application and want to synchronize the user with his roles between my application and my Discord server in order to manage roles in one place.
Requiremensts
- PHP 8 <3
- Bot token and the bot should be in your server
Install
composer require 0xwaleed/discorole
Examples
When you need to check for member's roles/permissions
use DiscoRole\PermissionConstants; $d = new \DiscoRole\DiscoRole(token: 'your bot token'); $guild = $d->getGuild('guild id here'); $member = $guild->getMember('member id here'); //if we want to check for specific role if ($member->has('role id')) { //do your logic } //if we want to traverse all member's roles and check if one of them //has the these permissions if ($member->has(PermissionContatns::MANAGE_MESSAGES | PermissionContatns::MANAGE_GUILD)) { //do your logic }
When you want to get role details
foreach ($member->roles as $role) { $role->id; $role->name; $role->color; ... }
统计信息
- 总下载量: 19
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-09-30