diff options
Diffstat (limited to 'src/util/entities')
-rw-r--r-- | src/util/entities/Channel.ts | 7 | ||||
-rw-r--r-- | src/util/entities/User.ts | 9 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/util/entities/Channel.ts b/src/util/entities/Channel.ts index 9ce04848..72490028 100644 --- a/src/util/entities/Channel.ts +++ b/src/util/entities/Channel.ts @@ -482,3 +482,10 @@ export enum ChannelPermissionOverwriteType { member = 1, group = 2, } + +export interface DMChannel extends Omit<Channel, "type" | "recipients"> { + type: ChannelType.DM | ChannelType.GROUP_DM; + recipients: Recipient[]; + + // TODO: probably more props +} diff --git a/src/util/entities/User.ts b/src/util/entities/User.ts index df9af328..b30a7c58 100644 --- a/src/util/entities/User.ts +++ b/src/util/entities/User.ts @@ -280,6 +280,15 @@ export class User extends BaseClass { return user as PublicUser; } + toPrivateUser() { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const user: any = {}; + PrivateUserProjection.forEach((x) => { + user[x] = this[x]; + }); + return user as UserPrivate; + } + static async getPublicUser(user_id: string, opts?: FindOneOptions<User>) { return await User.findOneOrFail({ where: { id: user_id }, |