summary refs log tree commit diff
path: root/src/util/User.ts
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-02-22 15:51:53 +0100
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-02-22 15:51:53 +0100
commita0cb65ccad9036c9f58de3ae800b20e99c8a430e (patch)
treea4fb59f57a50488be6d4b7aa1823bec646ec9613 /src/util/User.ts
parent:art: [Ban] use removeMember() + move ban in seperate file (diff)
downloadserver-a0cb65ccad9036c9f58de3ae800b20e99c8a430e.tar.xz
:art: restructure + add/remove Member() function
Diffstat (limited to 'src/util/User.ts')
-rw-r--r--src/util/User.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/util/User.ts b/src/util/User.ts
new file mode 100644

index 00000000..778730e2 --- /dev/null +++ b/src/util/User.ts
@@ -0,0 +1,18 @@ +import { UserModel } from "fosscord-server-util"; +import { HTTPError } from "lambert-server"; + +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, + ...additional_fields, + } + ).exec(); + if (!user) throw new HTTPError("User not found", 404); + return user; +}