Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Structures): Add PermissionOverwrite #35

Open
wants to merge 7 commits into
base: beta
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion structures/Channel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Base from './Base';
import { PermissionOverwrite } from './Permissions';

export default interface Channel extends Base {
application_id?: string;
Expand All @@ -14,7 +15,7 @@ export default interface Channel extends Base {
nsfw?: boolean;
owner_id?: string;
parent_id?: string | null;
permission_overwrites?: unknown[]; // TODO Overwrite
permission_overwrites?: PermissionOverwrite[];
position?: number;
rate_limit_per_user?: number;
recipients?: [unknown]; // TODO User
Expand Down
11 changes: 11 additions & 0 deletions structures/Permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// @ts-nocheck
// NOTE Can't enun bigints, but reverse mappings will cast bigints to stringified keys.
// NOTE See https://github.com/microsoft/TypeScript/issues/40793 and https://github.com/microsoft/TypeScript/issues/37783
import Base from './Base';

enum Permissions {
CREATE_INSTANT_INVITE = 1n << 0n,
Expand Down Expand Up @@ -43,5 +44,15 @@ enum Permissions {
USE_PRIVATE_THREADS = 1n << 36n,
}

export interface PermissionOverwrite extends Base {
allow: string;
deny: string;
SiroTM marked this conversation as resolved.
Show resolved Hide resolved
type: PermissionOverwriteType;
}

export enum PermissionOverwriteType {
ROLE,
MEMBER,
}

export default Permissions;
2 changes: 1 addition & 1 deletion structures/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export { default as GuildPreview } from './GuildPreview';
export { default as GuildTemplate } from './GuildTemplate';
export { default as Invite, InviteMetadata, InviteTargetType } from './Invite';
export { default as Message, MessageActivity, MessageActivityType, MessageFlags, MessageReference, MessageType, Reaction } from './Message';
export { default as Permissions } from './Permissions';
export { default as Permissions, PermissionOverwrite, PermissionOverwriteType } from './Permissions';
export { default as UserConnection, ConnectionVisibilityType } from './UserConnections';
export { default as VoiceRegion } from './VoiceRegion';
export { default as VoiceState } from './VoiceState';
Expand Down