Merge branch 'master' of https://github.com/fosscord/fosscord-api
This commit is contained in:
commit
48c796bbd3
BIN
api/package-lock.json
generated
BIN
api/package-lock.json
generated
Binary file not shown.
@ -35,7 +35,6 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/fosscord/fosscord-api#readme",
|
"homepage": "https://github.com/fosscord/fosscord-api#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fosscord/server-util": "^1.3.52",
|
|
||||||
"@fosscord/util": "file:../util",
|
"@fosscord/util": "file:../util",
|
||||||
"@types/jest": "^26.0.22",
|
"@types/jest": "^26.0.22",
|
||||||
"@types/json-schema": "^7.0.7",
|
"@types/json-schema": "^7.0.7",
|
||||||
|
|||||||
@ -17,8 +17,8 @@ router.patch("/", check(MemberNickChangeSchema), async (req: Request, res: Respo
|
|||||||
const perms = await getPermission(req.user_id, guild_id);
|
const perms = await getPermission(req.user_id, guild_id);
|
||||||
perms.hasThrow(permissionString);
|
perms.hasThrow(permissionString);
|
||||||
|
|
||||||
await changeNickname(member_id, guild_id, req.body.nickname);
|
await changeNickname(member_id, guild_id, req.body.nick);
|
||||||
res.status(204);
|
res.status(200).send();
|
||||||
});
|
});
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
|||||||
14
api/src/schema/Emoji.ts
Normal file
14
api/src/schema/Emoji.ts
Normal 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
|
||||||
|
}
|
||||||
@ -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) {
|
export async function changeNickname(user_id: string, guild_id: string, nickname: string) {
|
||||||
const user = await getPublicUser(user_id);
|
const user = await getPublicUser(user_id);
|
||||||
|
|
||||||
|
|
||||||
var memberObj = await MemberModel.findOneAndUpdate(
|
var memberObj = await MemberModel.findOneAndUpdate(
|
||||||
{
|
{
|
||||||
id: user_id,
|
id: user_id,
|
||||||
|
|||||||
@ -26,6 +26,8 @@ export const IdentifySchema = {
|
|||||||
$client_event_source: String,
|
$client_event_source: String,
|
||||||
$client_version: String,
|
$client_version: String,
|
||||||
$system_locale: String,
|
$system_locale: String,
|
||||||
|
$window_manager: String,
|
||||||
|
$distro: String,
|
||||||
},
|
},
|
||||||
$presence: ActivitySchema,
|
$presence: ActivitySchema,
|
||||||
$compress: Boolean,
|
$compress: Boolean,
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@fosscord/util",
|
"name": "@fosscord/util",
|
||||||
"version": "1.3.52",
|
"version": "1.3.55",
|
||||||
"description": "Utility functions and database models for fosscord",
|
"description": "Utility functions for the all server repositories",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@ -49,7 +49,7 @@ type PermissionString =
|
|||||||
| "MANAGE_NICKNAMES"
|
| "MANAGE_NICKNAMES"
|
||||||
| "MANAGE_ROLES"
|
| "MANAGE_ROLES"
|
||||||
| "MANAGE_WEBHOOKS"
|
| "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
|
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_NICKNAMES: BigInt(1) << BigInt(27),
|
||||||
MANAGE_ROLES: BigInt(1) << BigInt(28),
|
MANAGE_ROLES: BigInt(1) << BigInt(28),
|
||||||
MANAGE_WEBHOOKS: BigInt(1) << BigInt(29),
|
MANAGE_WEBHOOKS: BigInt(1) << BigInt(29),
|
||||||
MANAGE_EMOJIS: BigInt(1) << BigInt(30),
|
MANAGE_EMOJIS_AND_STICKERS: BigInt(1) << BigInt(30),
|
||||||
/**
|
/**
|
||||||
* CUSTOM PERMISSIONS ideas:
|
* CUSTOM PERMISSIONS ideas:
|
||||||
* - allow user to dm members
|
* - allow user to dm members
|
||||||
|
|||||||
Reference in New Issue
Block a user