summary refs log tree commit diff
path: root/util/src/entities/Channel.ts
diff options
context:
space:
mode:
authorAlTech98 <altech123159@gmail.com>2021-09-16 21:33:36 +0200
committerAlTech98 <altech123159@gmail.com>2021-09-16 21:33:36 +0200
commit4f87fd742f25a25782afb20131200bcff81b50f7 (patch)
tree9588f6319e6b21eb4415e796a690a57b6e7ecb50 /util/src/entities/Channel.ts
parentDummy sticker-packs routes (diff)
downloadserver-4f87fd742f25a25782afb20131200bcff81b50f7.tar.xz
Implemented DMs and group DMs
Diffstat (limited to 'util/src/entities/Channel.ts')
-rw-r--r--util/src/entities/Channel.ts15
1 files changed, 8 insertions, 7 deletions
diff --git a/util/src/entities/Channel.ts b/util/src/entities/Channel.ts
index fc954f63..6eac19ca 100644
--- a/util/src/entities/Channel.ts
+++ b/util/src/entities/Channel.ts
@@ -1,7 +1,6 @@
-import { Column, Entity, JoinColumn, JoinTable, ManyToMany, ManyToOne, OneToMany, RelationId } from "typeorm";
+import { Column, Entity, JoinColumn, ManyToOne, OneToMany, RelationId } from "typeorm";
 import { BaseClass } from "./BaseClass";
 import { Guild } from "./Guild";
-import { Message } from "./Message";
 import { User } from "./User";
 import { HTTPError } from "lambert-server";
 import { emitEvent, getPermission, Snowflake } from "../util";
@@ -31,6 +30,9 @@ export class Channel extends BaseClass {
 	@Column({ nullable: true })
 	name?: string;
 
+	@Column({ nullable: true })
+	icon?: string;
+
 	@Column({ type: "simple-enum", enum: ChannelType })
 	type: ChannelType;
 
@@ -38,13 +40,8 @@ export class Channel extends BaseClass {
 	recipients?: Recipient[];
 
 	@Column({ nullable: true })
-	@RelationId((channel: Channel) => channel.last_message)
 	last_message_id: string;
 
-	@JoinColumn({ name: "last_message_id" })
-	@ManyToOne(() => Message)
-	last_message?: Message;
-
 	@Column({ nullable: true })
 	@RelationId((channel: Channel) => channel.guild)
 	guild_id?: string;
@@ -162,6 +159,10 @@ export class Channel extends BaseClass {
 
 		return channel;
 	}
+
+	isDm() {
+		return this.type === ChannelType.DM || this.type === ChannelType.GROUP_DM
+	}
 }
 
 export interface ChannelPermissionOverwrite {