🐛 [Member] list fix to also return user

This commit is contained in:
Flam3rboy
2021-02-23 22:02:50 +01:00
parent 01eb91a63e
commit 5c11bf1b87
4 changed files with 17 additions and 11 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ export async function addMember(user_id: bigint, guild_id: bigint, cache?: { gui
const { maxGuilds } = Config.get().limits.user;
if (guildSize >= maxGuilds) {
throw new HTTPError(` You are at the ${maxGuilds} server limit.`, 403);
throw new HTTPError(`You are at the ${maxGuilds} server limit.`, 403);
}
const guild = cache?.guild || (await GuildModel.findOne({ id: guild_id }).exec());
+9 -5
View File
@@ -1,15 +1,19 @@
import { UserModel } from "fosscord-server-util";
import { HTTPError } from "lambert-server";
export const PublicUserProjection = {
username: true,
discriminator: true,
id: true,
public_flags: true,
avatar: true,
};
export async function getPublicUser(user_id: bigint, additional_fields?: any) {
const user = await UserModel.findOne(
{ id: user_id },
{
username: true,
discriminator: true,
id: true,
public_flags: true,
avatar: true,
...PublicUserProjection,
...additional_fields,
}
).exec();