mirror of
https://github.com/spacebarchat/server.git
synced 2026-09-17 14:36:32 +00:00
Fix webhook schema
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -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,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
// TODO: remove entity import
|
||||
import { Sticker } from "@spacebar/database";
|
||||
import { Embed, MessageActivity, MessageComponent, PartialUser, Poll, PublicChannel, Snowflake } from "@spacebar/schemas";
|
||||
import { Embed, MessageActivity, MessageComponent, PartialUser, Poll, PublicChannel, Snowflake, WebhookType } from "@spacebar/schemas";
|
||||
import { PublicAttachment } from "./Attachments";
|
||||
|
||||
export enum MessageType {
|
||||
@@ -207,6 +207,18 @@ export interface PublicMessage {
|
||||
// soundboard_sounds?: SoundboardSound[];
|
||||
potions?: Potion[];
|
||||
shared_client_theme?: SharedClientTheme;
|
||||
// spacebar extension
|
||||
webhook: PublicMessageWebhook;
|
||||
}
|
||||
|
||||
export interface PublicMessageWebhook {
|
||||
type: WebhookType;
|
||||
name: string;
|
||||
avatar: string;
|
||||
user_id: string;
|
||||
application_id: string;
|
||||
source_guild_id: string | undefined;
|
||||
source_channel_id: string;
|
||||
}
|
||||
|
||||
export interface SharedClientTheme {
|
||||
|
||||
Reference in New Issue
Block a user