mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-22 18:32:29 +01:00
🐛 fix channel permission overwrites
This commit is contained in:
parent
dd611d0e7c
commit
d0f5790235
@ -1,4 +1,33 @@
|
|||||||
{
|
{
|
||||||
|
"LoginSchema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"login": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"password": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"undelete": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"captcha_key": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"login_source": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"gift_code_sku_id": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"required": [
|
||||||
|
"login",
|
||||||
|
"password"
|
||||||
|
],
|
||||||
|
"$schema": "http://json-schema.org/draft-07/schema#"
|
||||||
|
},
|
||||||
"RegisterSchema": {
|
"RegisterSchema": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@ -42,35 +71,6 @@
|
|||||||
],
|
],
|
||||||
"$schema": "http://json-schema.org/draft-07/schema#"
|
"$schema": "http://json-schema.org/draft-07/schema#"
|
||||||
},
|
},
|
||||||
"LoginSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"login": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"password": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"undelete": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"captcha_key": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"login_source": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"gift_code_sku_id": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"additionalProperties": false,
|
|
||||||
"required": [
|
|
||||||
"login",
|
|
||||||
"password"
|
|
||||||
],
|
|
||||||
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
||||||
},
|
|
||||||
"ChannelModifySchema": {
|
"ChannelModifySchema": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@ -127,10 +127,10 @@
|
|||||||
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
||||||
},
|
},
|
||||||
"allow": {
|
"allow": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deny": {
|
"deny": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
@ -353,10 +353,10 @@
|
|||||||
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
||||||
},
|
},
|
||||||
"allow": {
|
"allow": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deny": {
|
"deny": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
@ -727,10 +727,10 @@
|
|||||||
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
||||||
},
|
},
|
||||||
"allow": {
|
"allow": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deny": {
|
"deny": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
@ -1050,10 +1050,10 @@
|
|||||||
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
||||||
},
|
},
|
||||||
"allow": {
|
"allow": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deny": {
|
"deny": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
@ -1352,10 +1352,10 @@
|
|||||||
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
||||||
},
|
},
|
||||||
"allow": {
|
"allow": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deny": {
|
"deny": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
@ -1657,10 +1657,10 @@
|
|||||||
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
||||||
},
|
},
|
||||||
"allow": {
|
"allow": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deny": {
|
"deny": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
@ -1758,10 +1758,10 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"allow": {
|
"allow": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deny": {
|
"deny": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"id": {
|
"id": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
@ -1971,10 +1971,10 @@
|
|||||||
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
||||||
},
|
},
|
||||||
"allow": {
|
"allow": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deny": {
|
"deny": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
@ -2278,10 +2278,10 @@
|
|||||||
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
||||||
},
|
},
|
||||||
"allow": {
|
"allow": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deny": {
|
"deny": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
@ -2580,10 +2580,10 @@
|
|||||||
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
||||||
},
|
},
|
||||||
"allow": {
|
"allow": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deny": {
|
"deny": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
@ -2894,10 +2894,10 @@
|
|||||||
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
||||||
},
|
},
|
||||||
"allow": {
|
"allow": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deny": {
|
"deny": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
@ -3221,10 +3221,10 @@
|
|||||||
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
||||||
},
|
},
|
||||||
"allow": {
|
"allow": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deny": {
|
"deny": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
@ -3587,10 +3587,10 @@
|
|||||||
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
||||||
},
|
},
|
||||||
"allow": {
|
"allow": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deny": {
|
"deny": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
@ -3889,10 +3889,10 @@
|
|||||||
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
||||||
},
|
},
|
||||||
"allow": {
|
"allow": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deny": {
|
"deny": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
@ -4191,10 +4191,10 @@
|
|||||||
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
||||||
},
|
},
|
||||||
"allow": {
|
"allow": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deny": {
|
"deny": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
@ -4505,10 +4505,10 @@
|
|||||||
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
||||||
},
|
},
|
||||||
"allow": {
|
"allow": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deny": {
|
"deny": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
@ -4814,10 +4814,10 @@
|
|||||||
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
||||||
},
|
},
|
||||||
"allow": {
|
"allow": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deny": {
|
"deny": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
@ -5119,10 +5119,10 @@
|
|||||||
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
||||||
},
|
},
|
||||||
"allow": {
|
"allow": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deny": {
|
"deny": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
@ -5424,10 +5424,10 @@
|
|||||||
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
||||||
},
|
},
|
||||||
"allow": {
|
"allow": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deny": {
|
"deny": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
@ -5725,10 +5725,10 @@
|
|||||||
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
||||||
},
|
},
|
||||||
"allow": {
|
"allow": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deny": {
|
"deny": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
@ -6046,10 +6046,10 @@
|
|||||||
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
||||||
},
|
},
|
||||||
"allow": {
|
"allow": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deny": {
|
"deny": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
@ -6374,10 +6374,10 @@
|
|||||||
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
||||||
},
|
},
|
||||||
"allow": {
|
"allow": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deny": {
|
"deny": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
@ -6680,10 +6680,10 @@
|
|||||||
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
||||||
},
|
},
|
||||||
"allow": {
|
"allow": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deny": {
|
"deny": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
@ -6988,10 +6988,10 @@
|
|||||||
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
||||||
},
|
},
|
||||||
"allow": {
|
"allow": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deny": {
|
"deny": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
@ -7302,10 +7302,10 @@
|
|||||||
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
||||||
},
|
},
|
||||||
"allow": {
|
"allow": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deny": {
|
"deny": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
@ -7610,10 +7610,10 @@
|
|||||||
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
||||||
},
|
},
|
||||||
"allow": {
|
"allow": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deny": {
|
"deny": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
@ -7939,10 +7939,10 @@
|
|||||||
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
||||||
},
|
},
|
||||||
"allow": {
|
"allow": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deny": {
|
"deny": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
@ -8244,10 +8244,10 @@
|
|||||||
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
||||||
},
|
},
|
||||||
"allow": {
|
"allow": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deny": {
|
"deny": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
@ -8550,10 +8550,10 @@
|
|||||||
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
||||||
},
|
},
|
||||||
"allow": {
|
"allow": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deny": {
|
"deny": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
@ -9039,10 +9039,10 @@
|
|||||||
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
"$ref": "#/definitions/ChannelPermissionOverwriteType"
|
||||||
},
|
},
|
||||||
"allow": {
|
"allow": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"deny": {
|
"deny": {
|
||||||
"type": "bigint"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
"dev": "tsnd --respawn src/start.ts",
|
"dev": "tsnd --respawn src/start.ts",
|
||||||
"patch": "ts-patch install -s && npx patch-package",
|
"patch": "ts-patch install -s && npx patch-package",
|
||||||
"postinstall": "npm run patch",
|
"postinstall": "npm run patch",
|
||||||
"generate:docs": "node scripts/generate_openapi.ts",
|
"generate:docs": "node scripts/generate_openapi",
|
||||||
"generate:schema": "node scripts/generate_schema.ts"
|
"generate:schema": "node scripts/generate_schema"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
// https://mermade.github.io/openapi-gui/#
|
// https://mermade.github.io/openapi-gui/#
|
||||||
// https://editor.swagger.io/
|
// https://editor.swagger.io/
|
||||||
import path from "path";
|
const path = require("path");
|
||||||
import fs from "fs";
|
const fs = require("fs");
|
||||||
import * as TJS from "typescript-json-schema";
|
const TJS = require("typescript-json-schema");
|
||||||
import "missing-native-js-functions";
|
require("missing-native-js-functions");
|
||||||
const schemaPath = path.join(__dirname, "..", "assets", "schemas.json");
|
const schemaPath = path.join(__dirname, "..", "assets", "schemas.json");
|
||||||
|
|
||||||
const settings = {
|
const settings = {
|
||||||
|
@ -62,8 +62,8 @@ export interface ChannelModifySchema {
|
|||||||
permission_overwrites?: {
|
permission_overwrites?: {
|
||||||
id: string;
|
id: string;
|
||||||
type: ChannelPermissionOverwriteType;
|
type: ChannelPermissionOverwriteType;
|
||||||
allow: bigint;
|
allow: string;
|
||||||
deny: bigint;
|
deny: string;
|
||||||
}[];
|
}[];
|
||||||
parent_id?: string;
|
parent_id?: string;
|
||||||
id?: string; // is not used (only for guild create)
|
id?: string; // is not used (only for guild create)
|
||||||
|
@ -1,4 +1,13 @@
|
|||||||
import { Channel, ChannelPermissionOverwrite, ChannelUpdateEvent, emitEvent, getPermission, Member, Role } from "@fosscord/util";
|
import {
|
||||||
|
Channel,
|
||||||
|
ChannelPermissionOverwrite,
|
||||||
|
ChannelPermissionOverwriteType,
|
||||||
|
ChannelUpdateEvent,
|
||||||
|
emitEvent,
|
||||||
|
getPermission,
|
||||||
|
Member,
|
||||||
|
Role
|
||||||
|
} from "@fosscord/util";
|
||||||
import { Router, Response, Request } from "express";
|
import { Router, Response, Request } from "express";
|
||||||
import { HTTPError } from "lambert-server";
|
import { HTTPError } from "lambert-server";
|
||||||
|
|
||||||
@ -14,7 +23,7 @@ router.put(
|
|||||||
route({ body: "ChannelPermissionOverwriteSchema", permission: "MANAGE_ROLES" }),
|
route({ body: "ChannelPermissionOverwriteSchema", permission: "MANAGE_ROLES" }),
|
||||||
async (req: Request, res: Response) => {
|
async (req: Request, res: Response) => {
|
||||||
const { channel_id, overwrite_id } = req.params;
|
const { channel_id, overwrite_id } = req.params;
|
||||||
const body = req.body as { allow: bigint; deny: bigint; type: number; id: string };
|
const body = req.body as ChannelPermissionOverwriteSchema;
|
||||||
|
|
||||||
var channel = await Channel.findOneOrFail({ id: channel_id });
|
var channel = await Channel.findOneOrFail({ id: channel_id });
|
||||||
if (!channel.guild_id) throw new HTTPError("Channel not found", 404);
|
if (!channel.guild_id) throw new HTTPError("Channel not found", 404);
|
||||||
@ -31,14 +40,12 @@ router.put(
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
overwrite = {
|
overwrite = {
|
||||||
id: overwrite_id,
|
id: overwrite_id,
|
||||||
type: body.type,
|
type: body.type
|
||||||
allow: body.allow,
|
|
||||||
deny: body.deny
|
|
||||||
};
|
};
|
||||||
channel.permission_overwrites!.push(overwrite);
|
channel.permission_overwrites!.push(overwrite);
|
||||||
}
|
}
|
||||||
overwrite.allow = body.allow;
|
overwrite.allow = String(req.permission!.bitfield & (BigInt(body.allow) || 0n));
|
||||||
overwrite.deny = body.deny;
|
overwrite.deny = String(req.permission!.bitfield & (BigInt(body.deny) || 0n));
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
channel.save(),
|
channel.save(),
|
||||||
|
@ -320,8 +320,8 @@ export class Channel extends BaseClass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ChannelPermissionOverwrite {
|
export interface ChannelPermissionOverwrite {
|
||||||
allow: bigint; // for bitfields we use bigints
|
allow: string;
|
||||||
deny: bigint; // for bitfields we use bigints
|
deny: string;
|
||||||
id: string;
|
id: string;
|
||||||
type: ChannelPermissionOverwriteType;
|
type: ChannelPermissionOverwriteType;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user