Compare commits
No commits in common. "307969ffe59dbb752c2644ade400d65f6e678d51" and "76f77f7bfed610f00d79d26c30de72c3e59f891e" have entirely different histories.
307969ffe5
...
76f77f7bfe
3 changed files with 3 additions and 26 deletions
|
@ -1,11 +0,0 @@
|
||||||
export const enum Permission {
|
|
||||||
SendMessage = 1,
|
|
||||||
ManageChannel = 2,
|
|
||||||
ManageRole = 4,
|
|
||||||
CreateInvite = 8,
|
|
||||||
ManageInvite = 16,
|
|
||||||
ManageGuild = 32,
|
|
||||||
ManageMember = 64,
|
|
||||||
BanMember = 128,
|
|
||||||
KickMember = 256
|
|
||||||
}
|
|
|
@ -19,17 +19,16 @@ export interface GuildResponse {
|
||||||
description: string | null,
|
description: string | null,
|
||||||
icon: string | null,
|
icon: string | null,
|
||||||
owner_uuid: string,
|
owner_uuid: string,
|
||||||
roles: RoleResponse[],
|
roles: [],
|
||||||
member_count: number
|
member_count: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GuildMemberResponse {
|
export interface GuildMemberResponse {
|
||||||
uuid: string,
|
uuid: string,
|
||||||
nickname: string,
|
nickname: string,
|
||||||
|
user_uuid: string,
|
||||||
guild_uuid: string,
|
guild_uuid: string,
|
||||||
is_owner: boolean,
|
user: UserResponse
|
||||||
user: UserResponse,
|
|
||||||
roles: RoleResponse[]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GuildMembersResponse {
|
export interface GuildMembersResponse {
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
import type { Permission } from "~/types/enums";
|
|
||||||
import type { GuildMemberResponse } from "~/types/interfaces";
|
|
||||||
|
|
||||||
export default (member: GuildMemberResponse, permission: Permission) => {
|
|
||||||
for (const role of member.roles) {
|
|
||||||
if (role.permissions & permission) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue