This commit is contained in:
Flam3rboy 2021-08-13 13:07:25 +02:00
commit 48c796bbd3
8 changed files with 23 additions and 7 deletions

BIN
api/package-lock.json generated

Binary file not shown.

View File

@ -35,7 +35,6 @@
},
"homepage": "https://github.com/fosscord/fosscord-api#readme",
"dependencies": {
"@fosscord/server-util": "^1.3.52",
"@fosscord/util": "file:../util",
"@types/jest": "^26.0.22",
"@types/json-schema": "^7.0.7",

View File

@ -17,8 +17,8 @@ router.patch("/", check(MemberNickChangeSchema), async (req: Request, res: Respo
const perms = await getPermission(req.user_id, guild_id);
perms.hasThrow(permissionString);
await changeNickname(member_id, guild_id, req.body.nickname);
res.status(204);
await changeNickname(member_id, guild_id, req.body.nick);
res.status(200).send();
});
export default router;

14
api/src/schema/Emoji.ts Normal file
View File

@ -0,0 +1,14 @@
// https://discord.com/developers/docs/resources/emoji
export const EmojiCreateSchema = {
name: String, //name of the emoji
image: String, // image data the 128x128 emoji image uri
roles: Array //roles allowed to use this emoji
};
export interface EmojiCreateSchema {
name: string; // name of the emoji
image: string; // image data the 128x128 emoji image uri
roles: []; //roles allowed to use this emoji
}

View File

@ -197,6 +197,7 @@ export async function removeRole(user_id: string, guild_id: string, role_id: str
export async function changeNickname(user_id: string, guild_id: string, nickname: string) {
const user = await getPublicUser(user_id);
var memberObj = await MemberModel.findOneAndUpdate(
{
id: user_id,

View File

@ -26,6 +26,8 @@ export const IdentifySchema = {
$client_event_source: String,
$client_version: String,
$system_locale: String,
$window_manager: String,
$distro: String,
},
$presence: ActivitySchema,
$compress: Boolean,

View File

@ -1,7 +1,7 @@
{
"name": "@fosscord/util",
"version": "1.3.52",
"description": "Utility functions and database models for fosscord",
"version": "1.3.55",
"description": "Utility functions for the all server repositories",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {

View File

@ -49,7 +49,7 @@ type PermissionString =
| "MANAGE_NICKNAMES"
| "MANAGE_ROLES"
| "MANAGE_WEBHOOKS"
| "MANAGE_EMOJIS";
| "MANAGE_EMOJIS_AND_STICKERS";
const CUSTOM_PERMISSION_OFFSET = BigInt(1) << BigInt(48); // 16 free custom permission bits, and 16 for discord to add new ones
@ -87,7 +87,7 @@ export class Permissions extends BitField {
MANAGE_NICKNAMES: BigInt(1) << BigInt(27),
MANAGE_ROLES: BigInt(1) << BigInt(28),
MANAGE_WEBHOOKS: BigInt(1) << BigInt(29),
MANAGE_EMOJIS: BigInt(1) << BigInt(30),
MANAGE_EMOJIS_AND_STICKERS: BigInt(1) << BigInt(30),
/**
* CUSTOM PERMISSIONS ideas:
* - allow user to dm members