fix channel perm overwrite type

This commit is contained in:
Skillz
2020-09-22 19:07:50 -04:00
parent db61a954c7
commit 698c5ae066
2 changed files with 10 additions and 6 deletions
+3 -4
View File
@@ -11,7 +11,6 @@ import type {
} from "../types/channel.ts"; } from "../types/channel.ts";
import type { RawOverwrite } from "../types/guild.ts"; import type { RawOverwrite } from "../types/guild.ts";
import { logYellow } from "../utils/logger.ts";
import { endpoints } from "../constants/discord.ts"; import { endpoints } from "../constants/discord.ts";
import { RequestManager } from "../module/requestManager.ts"; import { RequestManager } from "../module/requestManager.ts";
import { Errors } from "../types/errors.ts"; import { Errors } from "../types/errors.ts";
@@ -189,7 +188,7 @@ export function deleteMessages(
} }
if (ids.length > 100) { if (ids.length > 100) {
logYellow( console.warn(
`This endpoint only accepts a maximum of 100 messages. Deleting the first 100 message ids provided.`, `This endpoint only accepts a maximum of 100 messages. Deleting the first 100 message ids provided.`,
); );
} }
@@ -326,11 +325,11 @@ export function editChannel(
allow: overwrite.allow.reduce( allow: overwrite.allow.reduce(
(bits, perm) => bits |= BigInt(Permissions[perm]), (bits, perm) => bits |= BigInt(Permissions[perm]),
BigInt(0), BigInt(0),
), ).toString(),
deny: overwrite.deny.reduce( deny: overwrite.deny.reduce(
(bits, perm) => bits |= BigInt(Permissions[perm]), (bits, perm) => bits |= BigInt(Permissions[perm]),
BigInt(0), BigInt(0),
), ).toString(),
}; };
}, },
), ),
+7 -2
View File
@@ -450,18 +450,23 @@ export interface Overwrite {
/** The role or user id */ /** The role or user id */
id: string; id: string;
/** Whether this is a role or a member */ /** Whether this is a role or a member */
type: "role" | "member"; type: OverwriteType;
/** The permissions that this id is allowed to do. (This will mark it as a green check.) */ /** The permissions that this id is allowed to do. (This will mark it as a green check.) */
allow: Permission[]; allow: Permission[];
/** The permissions that this id is NOT allowed to do. (This will mark it as a red x.) */ /** The permissions that this id is NOT allowed to do. (This will mark it as a red x.) */
deny: Permission[]; deny: Permission[];
} }
export enum OverwriteType {
ROLE,
MEMBER,
}
export interface RawOverwrite { export interface RawOverwrite {
/** The role or user id */ /** The role or user id */
id: string; id: string;
/** Whether this is a role or a member */ /** Whether this is a role or a member */
type: "role" | "member"; type: OverwriteType;
/** The permissions that this id is allowed to do. (This will mark it as a green check.) */ /** The permissions that this id is allowed to do. (This will mark it as a green check.) */
allow: number; allow: number;
/** The permissions that this id is NOT allowed to do. (This will mark it as a red x.) */ /** The permissions that this id is NOT allowed to do. (This will mark it as a red x.) */