summary refs log tree commit diff
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-06-17 02:17:59 +0200
committerRory& <root@rory.gay>2026-06-17 02:17:59 +0200
commit4aceae2bed793c68256083468899482539d771bc (patch)
treee14617eed91923959e47a72ff7097cb39db4f2df
parentextensions/String: use custom exception type (diff)
downloadserver-ts-4aceae2bed793c68256083468899482539d771bc.tar.xz
Clean up some imports to make API work again
-rw-r--r--src/api/util/handlers/Message.ts3
-rw-r--r--src/api/util/handlers/Webhook.ts20
-rw-r--r--src/database/entities/ApplicationCommand.ts4
-rw-r--r--src/database/entities/Attachment.ts2
-rw-r--r--src/util/util/lambert-server/Server.ts4
5 files changed, 27 insertions, 6 deletions
diff --git a/src/api/util/handlers/Message.ts b/src/api/util/handlers/Message.ts

index e2fc798d..9dbad645 100644 --- a/src/api/util/handlers/Message.ts +++ b/src/api/util/handlers/Message.ts
@@ -18,7 +18,8 @@ import { HTTPError } from "lambert-server/HTTPError"; import { Equal, In, Or } from "typeorm"; -import { fillMessageUrlEmbeds } from "@spacebar/api"; +// noinspection ES6PreferShortImport -- Causes a circular reference... +import { fillMessageUrlEmbeds } from "../utility/EmbedHandlers"; import { getDatabase, Application, Attachment, Channel, CloudAttachment, Guild, Member, Message, ReadState, Role, Session, Sticker, User, Webhook } from "@spacebar/database"; import { mathLogBase, arrayDistributeSequentially, Stopwatch, Random } from "@spacebar/extensions"; import { diff --git a/src/api/util/handlers/Webhook.ts b/src/api/util/handlers/Webhook.ts
index 02fe6690..1f4f60a7 100644 --- a/src/api/util/handlers/Webhook.ts +++ b/src/api/util/handlers/Webhook.ts
@@ -1,7 +1,25 @@ +/* + 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/>. +*/ + import { Request, Response } from "express"; import { HTTPError } from "lambert-server/HTTPError"; import { MoreThan } from "typeorm"; -import { handleMessage, postHandleMessage } from "@spacebar/api"; +import { handleMessage, postHandleMessage } from "./Message"; import { Attachment, Channel, Message, Webhook } from "@spacebar/database"; import { Config, DiscordApiErrors, emitEvent, FieldErrors, MessageCreateEvent, Snowflake, uploadFile, ValidateName } from "@spacebar/util"; import { WebhookExecuteSchema } from "@spacebar/schemas"; diff --git a/src/database/entities/ApplicationCommand.ts b/src/database/entities/ApplicationCommand.ts
index 892bb833..8fc7ef9f 100644 --- a/src/database/entities/ApplicationCommand.ts +++ b/src/database/entities/ApplicationCommand.ts
@@ -18,15 +18,15 @@ import { Column, Entity } from "typeorm"; import { BaseClass } from "./BaseClass"; -import { +import type { ApplicationCommandHandlerType, ApplicationCommandOption, ApplicationCommandIndexPermissions, - ApplicationCommandType, Snowflake, ApplicationIntegrationType, InteractionContextType, } from "@spacebar/schemas"; +import { ApplicationCommandType } from "@spacebar/schemas/api/bots/ApplicationCommandSchema"; @Entity({ name: "application_commands", diff --git a/src/database/entities/Attachment.ts b/src/database/entities/Attachment.ts
index 9631e74b..08fb369a 100644 --- a/src/database/entities/Attachment.ts +++ b/src/database/entities/Attachment.ts
@@ -19,7 +19,7 @@ import { BeforeRemove, Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm"; import { Config, deleteFile } from "@spacebar/util/util"; import { getUrlSignature, NewUrlUserSignatureData, NewUrlSignatureData } from "@spacebar/util/Signing"; -import { PublicAttachment } from "@spacebar/schemas/api/messages/Attachments"; +import type { PublicAttachment } from "@spacebar/schemas/api/messages/Attachments"; import { BaseClass } from "./BaseClass"; @Entity({ diff --git a/src/util/util/lambert-server/Server.ts b/src/util/util/lambert-server/Server.ts
index 4a73f7c3..7c7b647d 100644 --- a/src/util/util/lambert-server/Server.ts +++ b/src/util/util/lambert-server/Server.ts
@@ -68,7 +68,9 @@ export class Server { return router; } catch (error) { - console.error(new Error(`[Server] Failed to register route ${path}: ${error}`)); + const err = new Error(`[Server] Failed to register route ${path}: ${error}`); + err.stack = (err.stack ?? "") + "\n Inner exception: " + (<Error>error).stack!.replaceAll("/:", "/index.ts:"); + console.error(err); } }