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,
|
||||
mention_roles: new_message.mention_roles,
|
||||
mention_everyone: new_message.mention_everyone,
|
||||
pinned: new_message.pinned_at != null,
|
||||
pinned: new_message.pinned,
|
||||
timestamp: new_message.timestamp,
|
||||
edited_timestamp: new_message.edited_timestamp,
|
||||
|
||||
|
||||
@ -155,7 +155,7 @@ router.get(
|
||||
embeds: x.embeds,
|
||||
mentions: x.mentions,
|
||||
mention_roles: x.mention_roles,
|
||||
pinned: x.pinned_at != null,
|
||||
pinned: x.pinned,
|
||||
mention_everyone: x.mention_everyone,
|
||||
tts: x.tts,
|
||||
timestamp: x.timestamp,
|
||||
|
||||
@ -188,6 +188,10 @@ export class Message extends BaseClass {
|
||||
@Column({ type: "timestamp", nullable: true })
|
||||
pinned_at: Date | null;
|
||||
|
||||
get pinned(): boolean {
|
||||
return this.pinned_at != null;
|
||||
}
|
||||
|
||||
@Column({ type: "int" })
|
||||
type: MessageType;
|
||||
|
||||
@ -259,6 +263,7 @@ export class Message extends BaseClass {
|
||||
components: this.components ?? undefined,
|
||||
poll: this.poll ?? undefined,
|
||||
content: this.content ?? "",
|
||||
pinned: this.pinned,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user