mirror of
https://github.com/spacebarchat/server.git
synced 2026-09-25 13:24:42 +00:00
Fix webhook schema
This commit is contained in:
@@ -341,7 +341,7 @@ export class Message extends BaseClass {
|
||||
nonce: this.nonce ?? undefined,
|
||||
tts: this.tts ?? false,
|
||||
guild: this.guild ?? undefined,
|
||||
webhook: this.webhook ?? undefined,
|
||||
webhook: this.webhook?.toMessageWebhook() ?? undefined,
|
||||
interaction: this.interaction ?? undefined,
|
||||
interaction_metadata: this.interaction_metadata ?? undefined,
|
||||
reactions: this.reactions ?? undefined,
|
||||
@@ -362,7 +362,7 @@ export class Message extends BaseClass {
|
||||
pinned: this.pinned,
|
||||
thread: this.thread ? this.thread.toJSON() : this.thread,
|
||||
referenced_message: this.referenced_message && !shallow ? this.referenced_message.toJSON(true) : undefined,
|
||||
};
|
||||
} satisfies PublicMessage;
|
||||
}
|
||||
|
||||
toPartialMessage(): PartialMessage {
|
||||
|
||||
@@ -22,7 +22,7 @@ import { BaseClass } from "./BaseClass";
|
||||
import { Channel } from "./Channel";
|
||||
import { Guild } from "./Guild";
|
||||
import { User } from "./User";
|
||||
import { WebhookType } from "@spacebar/schemas";
|
||||
import { PublicMessageWebhook, WebhookType } from "@spacebar/schemas";
|
||||
|
||||
@Entity({
|
||||
name: "webhooks",
|
||||
@@ -101,4 +101,16 @@ export class Webhook extends BaseClass {
|
||||
source_channel: Channel;
|
||||
|
||||
url: string;
|
||||
|
||||
public toMessageWebhook(): PublicMessageWebhook {
|
||||
return {
|
||||
type: this.type,
|
||||
name: this.name,
|
||||
avatar: this.avatar,
|
||||
user_id: this.user_id,
|
||||
application_id: this.application_id,
|
||||
source_guild_id: this.source_guild_id,
|
||||
source_channel_id: this.source_channel_id,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user