🐛 [Member] list fix to also return user
This commit is contained in:
+1
-1
@@ -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
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user