Merge branch 'master' into pr/LoboMetalurgico/424
This commit is contained in:
@@ -2,7 +2,7 @@ import { Router, Request, Response } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { route } from "@fosscord/api";
|
||||
import { random } from "@fosscord/api";
|
||||
import { getPermission, Channel, Invite, InviteCreateEvent, emitEvent, User, Guild, PublicInviteRelation } from "@fosscord/util";
|
||||
import { Channel, Invite, InviteCreateEvent, emitEvent, User, Guild, PublicInviteRelation } from "@fosscord/util";
|
||||
import { isTextChannel } from "./messages";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
@@ -22,7 +22,7 @@ const router: Router = Router();
|
||||
|
||||
export default router;
|
||||
|
||||
function isTextChannel(type: ChannelType): boolean {
|
||||
export function isTextChannel(type: ChannelType): boolean {
|
||||
switch (type) {
|
||||
case ChannelType.GUILD_STORE:
|
||||
case ChannelType.GUILD_VOICE:
|
||||
@@ -39,7 +39,6 @@ function isTextChannel(type: ChannelType): boolean {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
module.exports.isTextChannel = isTextChannel;
|
||||
|
||||
export interface MessageCreateSchema {
|
||||
content?: string;
|
||||
|
||||
@@ -44,8 +44,8 @@ router.put(
|
||||
};
|
||||
channel.permission_overwrites!.push(overwrite);
|
||||
}
|
||||
overwrite.allow = String(req.permission!.bitfield & (BigInt(body.allow) || 0n));
|
||||
overwrite.deny = String(req.permission!.bitfield & (BigInt(body.deny) || 0n));
|
||||
overwrite.allow = String(req.permission!.bitfield & (BigInt(body.allow) || BigInt("0")));
|
||||
overwrite.deny = String(req.permission!.bitfield & (BigInt(body.deny) || BigInt("0")));
|
||||
|
||||
await Promise.all([
|
||||
channel.save(),
|
||||
|
||||
@@ -57,7 +57,7 @@ router.post("/", route({ body: "RoleModifySchema", permission: "MANAGE_ROLES" })
|
||||
...body,
|
||||
guild_id: guild_id,
|
||||
managed: false,
|
||||
permissions: String(req.permission!.bitfield & (body.permissions || 0n)),
|
||||
permissions: String(req.permission!.bitfield & (body.permissions || BigInt("0"))),
|
||||
tags: undefined
|
||||
});
|
||||
|
||||
@@ -105,7 +105,12 @@ router.patch("/:role_id", route({ body: "RoleModifySchema", permission: "MANAGE_
|
||||
const { role_id, guild_id } = req.params;
|
||||
const body = req.body as RoleModifySchema;
|
||||
|
||||
const role = new Role({ ...body, id: role_id, guild_id, permissions: String(req.permission!.bitfield & (body.permissions || 0n)) });
|
||||
const role = new Role({
|
||||
...body,
|
||||
id: role_id,
|
||||
guild_id,
|
||||
permissions: String(req.permission!.bitfield & (body.permissions || BigInt("0")))
|
||||
});
|
||||
|
||||
await Promise.all([
|
||||
role.save(),
|
||||
|
||||
@@ -47,7 +47,7 @@ router.post("/:code", route({ body: "GuildTemplateCreateSchema" }), async (req:
|
||||
managed: true,
|
||||
mentionable: true,
|
||||
name: "@everyone",
|
||||
permissions: 2251804225n,
|
||||
permissions: BigInt("2251804225"),
|
||||
position: 0,
|
||||
tags: null
|
||||
}).save()
|
||||
|
||||
Reference in New Issue
Block a user