1
0
mirror of https://github.com/spacebarchat/docs.git synced 2024-11-09 03:42:32 +01:00

Update permissions.md

This commit is contained in:
Flam3rboy 2021-05-26 22:18:27 +02:00 committed by GitHub
parent 5d92e038f4
commit 121d9ad188
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,18 +4,19 @@ To get the permission for a guild member import the `getPermission` from `fossco
import { getPermission } from "fosscord-server-util";
```
The first argument is the user_id the second the guild_id and the third channel_id
If you want to receive the permission for a certain channel:
The first argument is the user_id the second the guild_id and the third an optional channel_id
```ts
const permissions = await getPermission(user_id: string, guild_id: string, channel_id?: string)
const permissions = await getPermission("106142653265366125", "4061326832657368175")
```
### Example
```ts
const perms = await getPermission(req.userid, guild_id);
// preferred method: Use this if you want to check if a user lacks a certain permission and abort the operation
perms.hasThrow("MANAGE_GUILD") // will throw an error if the users lacks the permission
if (perms.has("MANAGE_GUILD")) {