summary refs log tree commit diff
path: root/src/schemas/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/schemas/api')
-rw-r--r--src/schemas/api/bots/InteractionCallbackSchema.ts3
-rw-r--r--src/schemas/api/bots/InteractionCreateSchema.ts5
-rw-r--r--src/schemas/api/bots/InteractionSchema.ts38
-rw-r--r--src/schemas/api/bots/SendableApplicationCommandDataSchema.ts2
-rw-r--r--src/schemas/api/bots/SendableMessageComponentDataSchema.ts2
-rw-r--r--src/schemas/api/bots/SendableModalSubmitDataSchema.ts2
-rw-r--r--src/schemas/api/bots/index.ts1
-rw-r--r--src/schemas/api/channels/Channel.ts22
8 files changed, 64 insertions, 11 deletions
diff --git a/src/schemas/api/bots/InteractionCallbackSchema.ts b/src/schemas/api/bots/InteractionCallbackSchema.ts

index dd09fb90..ab0d7ca4 100644 --- a/src/schemas/api/bots/InteractionCallbackSchema.ts +++ b/src/schemas/api/bots/InteractionCallbackSchema.ts
@@ -16,9 +16,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { Message } from "@spacebar/util"; import { InteractionCallbackType } from "./InteractionCallbackType"; -import { AllowedMentions, BaseMessageComponents, Embed, MessageComponentType } from "../messages"; +import { AllowedMentions, BaseMessageComponents, Embed } from "../messages"; import { MessageCreateAttachment, MessageCreateCloudAttachment, PollCreationSchema } from "#schemas/uncategorised"; export interface InteractionCallbackSchema { diff --git a/src/schemas/api/bots/InteractionCreateSchema.ts b/src/schemas/api/bots/InteractionCreateSchema.ts
index 44e7e651..5a6d1c3f 100644 --- a/src/schemas/api/bots/InteractionCreateSchema.ts +++ b/src/schemas/api/bots/InteractionCreateSchema.ts
@@ -16,8 +16,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { PublicMember, PublicUser, Snowflake } from "@spacebar/schemas"; -import { Channel, InteractionType, Message } from "@spacebar/util"; +import { PublicMember, PublicUser, Snowflake, InteractionType } from "@spacebar/schemas"; +// TODO: remove entity imports +import { Channel, Message } from "@spacebar/util"; export interface InteractionCreateSchema { version: number; // TODO: types? diff --git a/src/schemas/api/bots/InteractionSchema.ts b/src/schemas/api/bots/InteractionSchema.ts
index 9e79df52..47c0f114 100644 --- a/src/schemas/api/bots/InteractionSchema.ts +++ b/src/schemas/api/bots/InteractionSchema.ts
@@ -16,8 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { ApplicationCommandOption, Snowflake, UploadAttachmentRequestSchema } from "@spacebar/schemas"; -import { InteractionType } from "@spacebar/util"; +import { AllowedMentions, ApplicationCommandOption, Embed, Snowflake, UploadAttachmentRequestSchema } from "@spacebar/schemas"; export interface InteractionSchema { type: InteractionType; @@ -44,3 +43,38 @@ interface InteractionData { type: number; version: string; } + +export interface Interaction { + id: string; + type: InteractionType; + data?: object; // TODO typing + guild_id: string; + channel_id: string; + member_id: string; + token: string; + version: number; +} + +export enum InteractionType { + Ping = 1, + ApplicationCommand = 2, + MessageComponent = 3, + ApplicationCommandAutocomplete = 4, + ModalSubmit = 5, +} + +export enum InteractionResponseType { + SelfCommandResponse = 0, + Pong = 1, + Acknowledge = 2, + ChannelMessage = 3, + ChannelMessageWithSource = 4, + AcknowledgeWithSource = 5, +} + +export interface InteractionApplicationCommandCallbackData { + tts?: boolean; + content: string; + embeds?: Embed[]; + allowed_mentions?: AllowedMentions; +} diff --git a/src/schemas/api/bots/SendableApplicationCommandDataSchema.ts b/src/schemas/api/bots/SendableApplicationCommandDataSchema.ts
index e559abe0..31a1abdd 100644 --- a/src/schemas/api/bots/SendableApplicationCommandDataSchema.ts +++ b/src/schemas/api/bots/SendableApplicationCommandDataSchema.ts
@@ -16,7 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { Snowflake } from "@spacebar/util"; +import { Snowflake } from "../../Identifiers"; import { ApplicationCommandOption } from "../developers"; import { ApplicationCommandType } from "./ApplicationCommandSchema"; diff --git a/src/schemas/api/bots/SendableMessageComponentDataSchema.ts b/src/schemas/api/bots/SendableMessageComponentDataSchema.ts
index 0ad37cc6..7237af42 100644 --- a/src/schemas/api/bots/SendableMessageComponentDataSchema.ts +++ b/src/schemas/api/bots/SendableMessageComponentDataSchema.ts
@@ -16,7 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { Snowflake } from "@spacebar/util"; +import { Snowflake } from "../../Identifiers"; import { MessageComponentType } from "../messages"; import { ApplicationCommandType } from "./ApplicationCommandSchema"; diff --git a/src/schemas/api/bots/SendableModalSubmitDataSchema.ts b/src/schemas/api/bots/SendableModalSubmitDataSchema.ts
index f898c0ca..7c305632 100644 --- a/src/schemas/api/bots/SendableModalSubmitDataSchema.ts +++ b/src/schemas/api/bots/SendableModalSubmitDataSchema.ts
@@ -17,7 +17,7 @@ */ import { UploadAttachmentRequestSchema } from "@spacebar/schemas"; -import { Snowflake } from "@spacebar/util"; +import { Snowflake } from "../../Identifiers"; export interface SendableModalSubmitDataSchema { id: Snowflake; diff --git a/src/schemas/api/bots/index.ts b/src/schemas/api/bots/index.ts
index fba2677a..4c1a7804 100644 --- a/src/schemas/api/bots/index.ts +++ b/src/schemas/api/bots/index.ts
@@ -15,6 +15,7 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ + export * from "./ApplicationCommandCreateSchema"; export * from "./ApplicationCommandSchema"; export * from "./InteractionSchema"; diff --git a/src/schemas/api/channels/Channel.ts b/src/schemas/api/channels/Channel.ts
index b9fb8c37..efa0f5f5 100644 --- a/src/schemas/api/channels/Channel.ts +++ b/src/schemas/api/channels/Channel.ts
@@ -1,6 +1,24 @@ -import { Channel, Guild, Invite, Message, ReadState, Recipient, Tag, ThreadMember, User, VoiceState, Webhook } from "@spacebar/util"; +/* + Spacebar: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2026 Spacebar and Spacebar Contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ + +// TODO: remove entity imports +import { Channel, Recipient, Tag, ThreadMember } from "@spacebar/util"; import { HTTPError } from "lambert-server"; -import { Column, JoinColumn, ManyToOne, OneToMany, RelationId } from "typeorm"; import { Snowflake } from "../../Identifiers"; import { PartialUser, PublicMember } from "../users";