refactor: add pinned getter to Message entity
This commit is contained in:
parent
dc3a85f078
commit
5c332ae763
@ -133,7 +133,7 @@ router.patch(
|
|||||||
mentions: new_message.embeds,
|
mentions: new_message.embeds,
|
||||||
mention_roles: new_message.mention_roles,
|
mention_roles: new_message.mention_roles,
|
||||||
mention_everyone: new_message.mention_everyone,
|
mention_everyone: new_message.mention_everyone,
|
||||||
pinned: new_message.pinned_at != null,
|
pinned: new_message.pinned,
|
||||||
timestamp: new_message.timestamp,
|
timestamp: new_message.timestamp,
|
||||||
edited_timestamp: new_message.edited_timestamp,
|
edited_timestamp: new_message.edited_timestamp,
|
||||||
|
|
||||||
|
|||||||
@ -155,7 +155,7 @@ router.get(
|
|||||||
embeds: x.embeds,
|
embeds: x.embeds,
|
||||||
mentions: x.mentions,
|
mentions: x.mentions,
|
||||||
mention_roles: x.mention_roles,
|
mention_roles: x.mention_roles,
|
||||||
pinned: x.pinned_at != null,
|
pinned: x.pinned,
|
||||||
mention_everyone: x.mention_everyone,
|
mention_everyone: x.mention_everyone,
|
||||||
tts: x.tts,
|
tts: x.tts,
|
||||||
timestamp: x.timestamp,
|
timestamp: x.timestamp,
|
||||||
|
|||||||
@ -188,6 +188,10 @@ export class Message extends BaseClass {
|
|||||||
@Column({ type: "timestamp", nullable: true })
|
@Column({ type: "timestamp", nullable: true })
|
||||||
pinned_at: Date | null;
|
pinned_at: Date | null;
|
||||||
|
|
||||||
|
get pinned(): boolean {
|
||||||
|
return this.pinned_at != null;
|
||||||
|
}
|
||||||
|
|
||||||
@Column({ type: "int" })
|
@Column({ type: "int" })
|
||||||
type: MessageType;
|
type: MessageType;
|
||||||
|
|
||||||
@ -259,6 +263,7 @@ export class Message extends BaseClass {
|
|||||||
components: this.components ?? undefined,
|
components: this.components ?? undefined,
|
||||||
poll: this.poll ?? undefined,
|
poll: this.poll ?? undefined,
|
||||||
content: this.content ?? "",
|
content: this.content ?? "",
|
||||||
|
pinned: this.pinned,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user