From bd231c4d9dc423ce7e9fa53cc432554803d3c293 Mon Sep 17 00:00:00 2001 From: Rory& Date: Wed, 17 Dec 2025 07:38:23 +0100 Subject: [PATCH] Prettier 2 --- .../channels/#channel_id/permissions.ts | 2 +- src/api/routes/channels/#channel_id/pins.ts | 14 +---- src/api/routes/channels/#channel_id/purge.ts | 33 ++---------- .../routes/channels/#channel_id/webhooks.ts | 36 +++---------- src/api/routes/channels/preload-messages.ts | 2 +- src/schemas/Identifiers.ts | 2 +- src/schemas/api/channels/Webhook.ts | 2 +- src/schemas/api/developers/Team.ts | 2 +- src/schemas/api/guilds/Automod.ts | 52 ++++++++++--------- .../api/guilds/GuildProfileResponse.ts | 5 +- src/schemas/api/guilds/Role.ts | 2 +- src/schemas/api/guilds/VoiceState.ts | 4 +- src/schemas/api/messages/Components.ts | 9 +--- src/schemas/api/messages/Message.ts | 1 - src/schemas/api/messages/Polls.ts | 2 +- src/schemas/api/users/ConnectedAccount.ts | 5 +- src/schemas/api/users/Member.ts | 2 +- src/schemas/api/users/SessionsSchemas.ts | 4 +- src/schemas/api/users/index.ts | 2 +- .../responses/APIErrorOrCaptchaResponse.ts | 4 +- .../responses/AccountStandingResponse.ts | 2 +- .../responses/DmMessagesResponseSchema.ts | 2 +- src/schemas/responses/GuildCreateResponse.ts | 2 +- .../responses/GuildMessagesSearchResponse.ts | 5 +- src/schemas/responses/GuildVanityUrl.ts | 5 +- .../responses/MemberJoinGuildResponse.ts | 2 +- .../PreloadMessagesResponseSchema.ts | 2 +- .../UploadAttachmentResponseSchema.ts | 1 - src/schemas/responses/UserProfileResponse.ts | 22 ++------ .../responses/UserRelationsResponse.ts | 6 +-- .../responses/UserRelationshipsResponse.ts | 2 +- .../uncategorised/AutomodRuleSchema.ts | 6 +-- .../uncategorised/GreetRequestSchema.ts | 4 +- .../uncategorised/MessageAcknowledgeSchema.ts | 2 +- .../uncategorised/RelationshipPutSchema.ts | 2 +- .../SettingsProtoUpdateSchema.ts | 2 +- .../UploadAttachmentRequestSchema.ts | 1 - .../uncategorised/UserGuildSettingsSchema.ts | 3 +- src/schemas/uncategorised/WebAuthnSchema.ts | 4 +- .../uncategorised/WebhookExecuteSchema.ts | 7 +-- src/util/util/DateBuilder.ts | 2 +- src/util/util/ElapsedTime.test.ts | 2 +- src/util/util/ElapsedTime.ts | 2 +- src/util/util/Token.ts | 2 +- 44 files changed, 85 insertions(+), 190 deletions(-) diff --git a/src/api/routes/channels/#channel_id/permissions.ts b/src/api/routes/channels/#channel_id/permissions.ts index e0feb3f95..c80d9a122 100644 --- a/src/api/routes/channels/#channel_id/permissions.ts +++ b/src/api/routes/channels/#channel_id/permissions.ts @@ -21,7 +21,7 @@ import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; import { route } from "@spacebar/api"; -import { ChannelPermissionOverwriteSchema, ChannelPermissionOverwrite, ChannelPermissionOverwriteType } from "@spacebar/schemas" +import { ChannelPermissionOverwriteSchema, ChannelPermissionOverwrite, ChannelPermissionOverwriteType } from "@spacebar/schemas"; const router: Router = Router({ mergeParams: true }); // TODO: Only permissions your bot has in the guild or channel can be allowed/denied (unless your bot has a MANAGE_ROLES overwrite in the channel) diff --git a/src/api/routes/channels/#channel_id/pins.ts b/src/api/routes/channels/#channel_id/pins.ts index a5aecda78..4b62115f7 100644 --- a/src/api/routes/channels/#channel_id/pins.ts +++ b/src/api/routes/channels/#channel_id/pins.ts @@ -17,16 +17,7 @@ */ import { route } from "@spacebar/api"; -import { - ChannelPinsUpdateEvent, - Config, - DiscordApiErrors, - emitEvent, - Message, - MessageCreateEvent, - MessageUpdateEvent, - User, -} from "@spacebar/util"; +import { ChannelPinsUpdateEvent, Config, DiscordApiErrors, emitEvent, Message, MessageCreateEvent, MessageUpdateEvent, User } from "@spacebar/util"; import { Request, Response, Router } from "express"; import { IsNull, Not } from "typeorm"; @@ -62,8 +53,7 @@ router.put( }); const { maxPins } = Config.get().limits.channel; - if (pinned_count >= maxPins) - throw DiscordApiErrors.MAXIMUM_PINS.withParams(maxPins); + if (pinned_count >= maxPins) throw DiscordApiErrors.MAXIMUM_PINS.withParams(maxPins); message.pinned_at = new Date(); diff --git a/src/api/routes/channels/#channel_id/purge.ts b/src/api/routes/channels/#channel_id/purge.ts index c8a2efab9..9686bc20c 100644 --- a/src/api/routes/channels/#channel_id/purge.ts +++ b/src/api/routes/channels/#channel_id/purge.ts @@ -17,14 +17,7 @@ */ import { route } from "@spacebar/api"; -import { - Channel, - Message, - MessageDeleteBulkEvent, - emitEvent, - getPermission, - getRights, -} from "@spacebar/util"; +import { Channel, Message, MessageDeleteBulkEvent, emitEvent, getPermission, getRights } from "@spacebar/util"; import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; import { Between, FindManyOptions, FindOperator, Not } from "typeorm"; @@ -56,17 +49,12 @@ router.post( where: { id: channel_id }, }); - if (!channel.guild_id) - throw new HTTPError("Can't purge dm channels", 400); + if (!channel.guild_id) throw new HTTPError("Can't purge dm channels", 400); isTextChannel(channel.type); const rights = await getRights(req.user_id); if (!rights.has("MANAGE_MESSAGES")) { - const permissions = await getPermission( - req.user_id, - channel.guild_id, - channel_id, - ); + const permissions = await getPermission(req.user_id, channel.guild_id, channel_id); permissions.hasThrow("MANAGE_MESSAGES"); permissions.hasThrow("MANAGE_CHANNELS"); } @@ -83,21 +71,10 @@ router.post( where: { channel_id, id: Between(after, before), // the right way around - author_id: rights.has("SELF_DELETE_MESSAGES") - ? undefined - : Not(req.user_id), + author_id: rights.has("SELF_DELETE_MESSAGES") ? undefined : Not(req.user_id), // if you lack the right of self-deletion, you can't delete your own messages, even in purges }, - relations: [ - "author", - "webhook", - "application", - "mentions", - "mention_roles", - "mention_channels", - "sticker_items", - "attachments", - ], + relations: ["author", "webhook", "application", "mentions", "mention_roles", "mention_channels", "sticker_items", "attachments"], }; const messages = await Message.find(query); diff --git a/src/api/routes/channels/#channel_id/webhooks.ts b/src/api/routes/channels/#channel_id/webhooks.ts index cddff7135..106d8442c 100644 --- a/src/api/routes/channels/#channel_id/webhooks.ts +++ b/src/api/routes/channels/#channel_id/webhooks.ts @@ -17,16 +17,7 @@ */ import { route } from "@spacebar/api"; -import { - Channel, - Config, - DiscordApiErrors, - User, - Webhook, - handleFile, - trimSpecial, - ValidateName, -} from "@spacebar/util"; +import { Channel, Config, DiscordApiErrors, User, Webhook, handleFile, trimSpecial, ValidateName } from "@spacebar/util"; import crypto from "crypto"; import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; @@ -37,8 +28,7 @@ const router: Router = Router({ mergeParams: true }); router.get( "/", route({ - description: - "Returns a list of channel webhook objects. Requires the MANAGE_WEBHOOKS permission.", + description: "Returns a list of channel webhook objects. Requires the MANAGE_WEBHOOKS permission.", permission: "MANAGE_WEBHOOKS", responses: { 200: { @@ -50,27 +40,14 @@ router.get( const { channel_id } = req.params; const webhooks = await Webhook.find({ where: { channel_id }, - relations: [ - "user", - "channel", - "source_channel", - "guild", - "source_guild", - "application", - ], + relations: ["user", "channel", "source_channel", "guild", "source_guild", "application"], }); - const instanceUrl = - Config.get().api.endpointPublic || "http://localhost:3001"; + const instanceUrl = Config.get().api.endpointPublic || "http://localhost:3001"; return res.json( webhooks.map((webhook) => ({ ...webhook, - url: - instanceUrl + - "/webhooks/" + - webhook.id + - "/" + - webhook.token, + url: instanceUrl + "/webhooks/" + webhook.id + "/" + webhook.token, })), ); }, @@ -103,8 +80,7 @@ router.post( const webhook_count = await Webhook.count({ where: { channel_id } }); const { maxWebhooks } = Config.get().limits.channel; - if (maxWebhooks && webhook_count > maxWebhooks) - throw DiscordApiErrors.MAXIMUM_WEBHOOKS.withParams(maxWebhooks); + if (maxWebhooks && webhook_count > maxWebhooks) throw DiscordApiErrors.MAXIMUM_WEBHOOKS.withParams(maxWebhooks); let { avatar, name } = req.body as WebhookCreateSchema; name = trimSpecial(name); diff --git a/src/api/routes/channels/preload-messages.ts b/src/api/routes/channels/preload-messages.ts index 47795703c..cdfc58f06 100644 --- a/src/api/routes/channels/preload-messages.ts +++ b/src/api/routes/channels/preload-messages.ts @@ -19,7 +19,7 @@ import { route } from "@spacebar/api"; import { Config, Message } from "@spacebar/util"; import { Request, Response, Router } from "express"; -import { PreloadMessagesRequestSchema, PreloadMessagesResponseSchema } from "@spacebar/schemas" +import { PreloadMessagesRequestSchema, PreloadMessagesResponseSchema } from "@spacebar/schemas"; const router = Router({ mergeParams: true }); router.post( diff --git a/src/schemas/Identifiers.ts b/src/schemas/Identifiers.ts index 5b462c1d0..ffdc456a5 100644 --- a/src/schemas/Identifiers.ts +++ b/src/schemas/Identifiers.ts @@ -26,4 +26,4 @@ * number of ms since Discord epoch worker pid increment * ``` */ -export type Snowflake = string; \ No newline at end of file +export type Snowflake = string; diff --git a/src/schemas/api/channels/Webhook.ts b/src/schemas/api/channels/Webhook.ts index 7f200ec8d..510916ce6 100644 --- a/src/schemas/api/channels/Webhook.ts +++ b/src/schemas/api/channels/Webhook.ts @@ -2,4 +2,4 @@ export enum WebhookType { Incoming = 1, ChannelFollower = 2, Application = 3, -} \ No newline at end of file +} diff --git a/src/schemas/api/developers/Team.ts b/src/schemas/api/developers/Team.ts index 94ddb8a54..131e9fb0f 100644 --- a/src/schemas/api/developers/Team.ts +++ b/src/schemas/api/developers/Team.ts @@ -6,4 +6,4 @@ export enum TeamMemberRole { ADMIN = "admin", DEVELOPER = "developer", READ_ONLY = "read_only", -} \ No newline at end of file +} diff --git a/src/schemas/api/guilds/Automod.ts b/src/schemas/api/guilds/Automod.ts index 473d98874..e7c3ab9b7 100644 --- a/src/schemas/api/guilds/Automod.ts +++ b/src/schemas/api/guilds/Automod.ts @@ -62,33 +62,35 @@ export enum AutomodRuleActionType { BLOCK_MESSAGE = 1, SEND_ALERT_MESSAGE = 2, TIMEOUT_USER = 3, - QUARANTINE_USER = 4 + QUARANTINE_USER = 4, } -export type AutomodAction = { - type: AutomodRuleActionType.BLOCK_MESSAGE; - metadata: { - custom_message?: string; - } -} | { - type: AutomodRuleActionType.SEND_ALERT_MESSAGE; - metadata: { - channel_id: Snowflake; - }; -} | { - type: AutomodRuleActionType.TIMEOUT_USER; - metadata: { - duration_seconds: number; - }; -} | { - type: AutomodRuleActionType.QUARANTINE_USER; - metadata: { - duration_seconds: number; - }; -}; +export type AutomodAction = + | { + type: AutomodRuleActionType.BLOCK_MESSAGE; + metadata: { + custom_message?: string; + }; + } + | { + type: AutomodRuleActionType.SEND_ALERT_MESSAGE; + metadata: { + channel_id: Snowflake; + }; + } + | { + type: AutomodRuleActionType.TIMEOUT_USER; + metadata: { + duration_seconds: number; + }; + } + | { + type: AutomodRuleActionType.QUARANTINE_USER; + metadata: { + duration_seconds: number; + }; + }; // TODO // eslint-disable-next-line -export interface AutomodRuleActionMetadata { - -} \ No newline at end of file +export interface AutomodRuleActionMetadata {} diff --git a/src/schemas/api/guilds/GuildProfileResponse.ts b/src/schemas/api/guilds/GuildProfileResponse.ts index 58e4b4857..703967ce6 100644 --- a/src/schemas/api/guilds/GuildProfileResponse.ts +++ b/src/schemas/api/guilds/GuildProfileResponse.ts @@ -26,7 +26,7 @@ export interface GuildProfileResponse { brand_color_primary: string; banner_hash: string | null; game_application_ids: string[]; - game_activity: {[id: string]: GameActivity}; + game_activity: { [id: string]: GameActivity }; tag: string | null; badge: GuildBadgeType; badge_color_primary: string; @@ -57,7 +57,7 @@ export interface GuildTrait { export enum GuildVisibilityLevel { PUBLIC = 1, RESTRICTED = 2, - PUBLIC_WITH_RECRUITMENT = 3 + PUBLIC_WITH_RECRUITMENT = 3, } export enum GuildBadgeType { @@ -93,4 +93,3 @@ export enum GuildBadgeType { MONEY_BAG = 29, DOLLAR_SIGN = 30, } - diff --git a/src/schemas/api/guilds/Role.ts b/src/schemas/api/guilds/Role.ts index 3775b3125..f9b010002 100644 --- a/src/schemas/api/guilds/Role.ts +++ b/src/schemas/api/guilds/Role.ts @@ -10,4 +10,4 @@ export class RoleColors { tertiary_color: this.tertiary_color ?? undefined, }; } -} \ No newline at end of file +} diff --git a/src/schemas/api/guilds/VoiceState.ts b/src/schemas/api/guilds/VoiceState.ts index 1c8d22229..b2275c70c 100644 --- a/src/schemas/api/guilds/VoiceState.ts +++ b/src/schemas/api/guilds/VoiceState.ts @@ -17,8 +17,6 @@ export enum PublicVoiceStateEnum { export type PublicVoiceStateKeys = keyof typeof PublicVoiceStateEnum; -export const PublicVoiceStateProjection = Object.values( - PublicVoiceStateEnum, -).filter((x) => typeof x === "string") as PublicVoiceStateKeys[]; +export const PublicVoiceStateProjection = Object.values(PublicVoiceStateEnum).filter((x) => typeof x === "string") as PublicVoiceStateKeys[]; export type PublicVoiceState = Pick; diff --git a/src/schemas/api/messages/Components.ts b/src/schemas/api/messages/Components.ts index 1415dea0d..96929ac47 100644 --- a/src/schemas/api/messages/Components.ts +++ b/src/schemas/api/messages/Components.ts @@ -24,12 +24,7 @@ export interface MessageComponent { export interface ActionRowComponent extends MessageComponent { type: MessageComponentType.ActionRow; - components: ( - | ButtonComponent - | StringSelectMenuComponent - | SelectMenuComponent - | TextInputComponent - )[]; + components: (ButtonComponent | StringSelectMenuComponent | SelectMenuComponent | TextInputComponent)[]; } export interface ButtonComponent extends MessageComponent { @@ -113,4 +108,4 @@ export enum MessageComponentType { RoleSelect = 6, MentionableSelect = 7, ChannelSelect = 8, -} \ No newline at end of file +} diff --git a/src/schemas/api/messages/Message.ts b/src/schemas/api/messages/Message.ts index 485e86420..30eccc76f 100644 --- a/src/schemas/api/messages/Message.ts +++ b/src/schemas/api/messages/Message.ts @@ -46,7 +46,6 @@ export enum MessageType { UNHANDLED = 255, } - /** * https://docs.discord.food/resources/message#partial-message-structure */ diff --git a/src/schemas/api/messages/Polls.ts b/src/schemas/api/messages/Polls.ts index c75717db6..d642388fc 100644 --- a/src/schemas/api/messages/Polls.ts +++ b/src/schemas/api/messages/Polls.ts @@ -16,7 +16,7 @@ along with this program. If not, see . */ -import { PartialEmoji } from "@spacebar/schemas" +import { PartialEmoji } from "@spacebar/schemas"; export interface Poll { question: PollMedia; diff --git a/src/schemas/api/users/ConnectedAccount.ts b/src/schemas/api/users/ConnectedAccount.ts index 66c9aea48..a62303400 100644 --- a/src/schemas/api/users/ConnectedAccount.ts +++ b/src/schemas/api/users/ConnectedAccount.ts @@ -1,6 +1,3 @@ import { ConnectedAccount } from "@spacebar/util"; -export type PublicConnectedAccount = Pick< - ConnectedAccount, - "name" | "type" | "verified" ->; \ No newline at end of file +export type PublicConnectedAccount = Pick; diff --git a/src/schemas/api/users/Member.ts b/src/schemas/api/users/Member.ts index 1acd441cb..025e4e140 100644 --- a/src/schemas/api/users/Member.ts +++ b/src/schemas/api/users/Member.ts @@ -92,4 +92,4 @@ export const PublicMemberProjection: PublicMemberKeys[] = [ export type PublicMember = Omit, "roles"> & { user: PublicUser; roles: string[]; // only role ids not objects -}; \ No newline at end of file +}; diff --git a/src/schemas/api/users/SessionsSchemas.ts b/src/schemas/api/users/SessionsSchemas.ts index 583b34909..b7c509be9 100644 --- a/src/schemas/api/users/SessionsSchemas.ts +++ b/src/schemas/api/users/SessionsSchemas.ts @@ -20,7 +20,7 @@ import { ActivitySchema, Snowflake } from "@spacebar/schemas"; import { ClientStatus } from "@spacebar/util"; export type SessionsLogoutSchema = { session_ids?: Snowflake[]; session_id_hashes?: string[] }; -export type GetSessionsResponse = { user_sessions: DeviceInfo[]; }; +export type GetSessionsResponse = { user_sessions: DeviceInfo[] }; export type DeviceInfo = { id: string; @@ -38,4 +38,4 @@ export type DeviceInfo = { last_seen?: Date; last_seen_ip?: string; last_seen_location?: string; -}; \ No newline at end of file +}; diff --git a/src/schemas/api/users/index.ts b/src/schemas/api/users/index.ts index 5c507121a..6400f42d7 100644 --- a/src/schemas/api/users/index.ts +++ b/src/schemas/api/users/index.ts @@ -19,4 +19,4 @@ export * from "./ConnectedAccount"; export * from "./InstanceUserDeleteSchema"; export * from "./Member"; export * from "./User"; -export * from "./UserSettings"; \ No newline at end of file +export * from "./UserSettings"; diff --git a/src/schemas/responses/APIErrorOrCaptchaResponse.ts b/src/schemas/responses/APIErrorOrCaptchaResponse.ts index fd89a4781..be9becdec 100644 --- a/src/schemas/responses/APIErrorOrCaptchaResponse.ts +++ b/src/schemas/responses/APIErrorOrCaptchaResponse.ts @@ -19,6 +19,4 @@ import { APIErrorResponse } from "./APIErrorResponse"; import { CaptchaRequiredResponse } from "./CaptchaRequiredResponse"; -export type APIErrorOrCaptchaResponse = - | CaptchaRequiredResponse - | APIErrorResponse; +export type APIErrorOrCaptchaResponse = CaptchaRequiredResponse | APIErrorResponse; diff --git a/src/schemas/responses/AccountStandingResponse.ts b/src/schemas/responses/AccountStandingResponse.ts index b2992c742..ea345be92 100644 --- a/src/schemas/responses/AccountStandingResponse.ts +++ b/src/schemas/responses/AccountStandingResponse.ts @@ -132,7 +132,7 @@ export interface Classification { export enum GuildMemberType { OWNER = 1, - MEMBER = 2 + MEMBER = 2, } export interface GuildMetadata { diff --git a/src/schemas/responses/DmMessagesResponseSchema.ts b/src/schemas/responses/DmMessagesResponseSchema.ts index 62347ef0c..c6f9b1367 100644 --- a/src/schemas/responses/DmMessagesResponseSchema.ts +++ b/src/schemas/responses/DmMessagesResponseSchema.ts @@ -16,6 +16,6 @@ along with this program. If not, see . */ -import { PartialMessage } from "@spacebar/schemas" +import { PartialMessage } from "@spacebar/schemas"; export type DmMessagesResponseSchema = PartialMessage[]; diff --git a/src/schemas/responses/GuildCreateResponse.ts b/src/schemas/responses/GuildCreateResponse.ts index 79331d2a0..afbf73cb5 100644 --- a/src/schemas/responses/GuildCreateResponse.ts +++ b/src/schemas/responses/GuildCreateResponse.ts @@ -17,7 +17,7 @@ */ import { GuildWelcomeScreen } from "@spacebar/util"; -import { GuildUpdateSchema } from "@spacebar/schemas" +import { GuildUpdateSchema } from "@spacebar/schemas"; export interface GuildCreateResponse extends Omit { id: string; diff --git a/src/schemas/responses/GuildMessagesSearchResponse.ts b/src/schemas/responses/GuildMessagesSearchResponse.ts index 9e7da5e45..cf59786a1 100644 --- a/src/schemas/responses/GuildMessagesSearchResponse.ts +++ b/src/schemas/responses/GuildMessagesSearchResponse.ts @@ -16,10 +16,7 @@ along with this program. If not, see . */ -import { - Attachment, - Role, -} from "../../util/entities"; +import { Attachment, Role } from "../../util/entities"; import { ActionRowComponent, Embed, MessageType, Poll, PublicUser } from "@spacebar/schemas"; export interface GuildMessagesSearchMessage { diff --git a/src/schemas/responses/GuildVanityUrl.ts b/src/schemas/responses/GuildVanityUrl.ts index c6595a661..c96049f76 100644 --- a/src/schemas/responses/GuildVanityUrl.ts +++ b/src/schemas/responses/GuildVanityUrl.ts @@ -25,10 +25,7 @@ export interface GuildVanityUrlNoInvite { code: null; } -export type GuildVanityUrlResponse = - | GuildVanityUrl - | GuildVanityUrl[] - | GuildVanityUrlNoInvite; +export type GuildVanityUrlResponse = GuildVanityUrl | GuildVanityUrl[] | GuildVanityUrlNoInvite; export interface GuildVanityUrlCreateResponse { code: string; diff --git a/src/schemas/responses/MemberJoinGuildResponse.ts b/src/schemas/responses/MemberJoinGuildResponse.ts index 1ef78eaa9..adef59ced 100644 --- a/src/schemas/responses/MemberJoinGuildResponse.ts +++ b/src/schemas/responses/MemberJoinGuildResponse.ts @@ -17,7 +17,7 @@ */ import { Emoji, Role, Sticker } from "../../util/entities"; -import { GuildCreateResponse } from "@spacebar/schemas" +import { GuildCreateResponse } from "@spacebar/schemas"; export interface MemberJoinGuildResponse { guild: GuildCreateResponse; diff --git a/src/schemas/responses/PreloadMessagesResponseSchema.ts b/src/schemas/responses/PreloadMessagesResponseSchema.ts index 9452896e7..0edb6a712 100644 --- a/src/schemas/responses/PreloadMessagesResponseSchema.ts +++ b/src/schemas/responses/PreloadMessagesResponseSchema.ts @@ -18,4 +18,4 @@ import { Message } from "@spacebar/util"; -export type PreloadMessagesResponseSchema = Message[]; \ No newline at end of file +export type PreloadMessagesResponseSchema = Message[]; diff --git a/src/schemas/responses/UploadAttachmentResponseSchema.ts b/src/schemas/responses/UploadAttachmentResponseSchema.ts index eab5f22ea..7d32ead3c 100644 --- a/src/schemas/responses/UploadAttachmentResponseSchema.ts +++ b/src/schemas/responses/UploadAttachmentResponseSchema.ts @@ -16,7 +16,6 @@ along with this program. If not, see . */ - export interface UploadAttachmentResponseSchema { attachments: UploadAttachmentResponse[]; } diff --git a/src/schemas/responses/UserProfileResponse.ts b/src/schemas/responses/UserProfileResponse.ts index 1a5fdc977..ee1eee62f 100644 --- a/src/schemas/responses/UserProfileResponse.ts +++ b/src/schemas/responses/UserProfileResponse.ts @@ -16,33 +16,19 @@ along with this program. If not, see . */ -import { - Badge, - Member, - User, -} from "@spacebar/util"; -import { - PublicConnectedAccount, - PublicMember, - PublicUser, -} from "@spacebar/schemas"; +import { Badge, Member, User } from "@spacebar/util"; +import { PublicConnectedAccount, PublicMember, PublicUser } from "@spacebar/schemas"; export type MutualGuild = { id: string; nick?: string; }; -export type PublicMemberProfile = Pick< - Member, - "banner" | "bio" | "guild_id" -> & { +export type PublicMemberProfile = Pick & { accent_color: null; // TODO }; -export type UserProfile = Pick< - User, - "bio" | "accent_color" | "banner" | "pronouns" | "theme_colors" ->; +export type UserProfile = Pick; export interface UserProfileResponse { user: PublicUser; diff --git a/src/schemas/responses/UserRelationsResponse.ts b/src/schemas/responses/UserRelationsResponse.ts index 808dd3d33..377cab099 100644 --- a/src/schemas/responses/UserRelationsResponse.ts +++ b/src/schemas/responses/UserRelationsResponse.ts @@ -17,8 +17,4 @@ */ import { User } from "@spacebar/util"; -export type UserRelationsResponse = (Pick & - Pick & - Pick & - Pick & - Pick)[]; +export type UserRelationsResponse = (Pick & Pick & Pick & Pick & Pick)[]; diff --git a/src/schemas/responses/UserRelationshipsResponse.ts b/src/schemas/responses/UserRelationshipsResponse.ts index a0f5ff5fb..0f1205442 100644 --- a/src/schemas/responses/UserRelationshipsResponse.ts +++ b/src/schemas/responses/UserRelationshipsResponse.ts @@ -16,7 +16,7 @@ along with this program. If not, see . */ -import { PublicUser, RelationshipType } from "@spacebar/schemas" +import { PublicUser, RelationshipType } from "@spacebar/schemas"; export interface UserRelationshipsResponse { id: string; diff --git a/src/schemas/uncategorised/AutomodRuleSchema.ts b/src/schemas/uncategorised/AutomodRuleSchema.ts index bc7510853..38e8faed4 100644 --- a/src/schemas/uncategorised/AutomodRuleSchema.ts +++ b/src/schemas/uncategorised/AutomodRuleSchema.ts @@ -45,11 +45,7 @@ export interface AutomodRuleSchema { name: string; position: number; trigger_type: number; //AutomodTriggerTypes - trigger_metadata: - | AutomodMentionSpamRuleSchema - | AutomodSuspectedSpamRuleSchema - | AutomodCommonlyFlaggedWordsRuleSchema - | AutomodCustomWordsRuleSchema; + trigger_metadata: AutomodMentionSpamRuleSchema | AutomodSuspectedSpamRuleSchema | AutomodCommonlyFlaggedWordsRuleSchema | AutomodCustomWordsRuleSchema; } export interface AutomodRuleSchemaWithId extends AutomodRuleSchema { diff --git a/src/schemas/uncategorised/GreetRequestSchema.ts b/src/schemas/uncategorised/GreetRequestSchema.ts index 28d1fddca..2a580f1ca 100644 --- a/src/schemas/uncategorised/GreetRequestSchema.ts +++ b/src/schemas/uncategorised/GreetRequestSchema.ts @@ -21,10 +21,10 @@ import { AllowedMentions } from "@spacebar/schemas"; export interface GreetRequestSchema { sticker_ids: string[]; allowed_mentions?: AllowedMentions; - message_reference?: { + message_reference?: { message_id: string; channel_id?: string; guild_id?: string; fail_if_not_exists?: boolean; }; -} \ No newline at end of file +} diff --git a/src/schemas/uncategorised/MessageAcknowledgeSchema.ts b/src/schemas/uncategorised/MessageAcknowledgeSchema.ts index 9df606222..0075fb319 100644 --- a/src/schemas/uncategorised/MessageAcknowledgeSchema.ts +++ b/src/schemas/uncategorised/MessageAcknowledgeSchema.ts @@ -42,4 +42,4 @@ export enum ReadStateFlags { IS_GUILD_CHANNEL = 1 << 0, IS_THREAD = 1 << 1, IS_MENTION_LOW_IMPORTANCE = 1 << 2, -} \ No newline at end of file +} diff --git a/src/schemas/uncategorised/RelationshipPutSchema.ts b/src/schemas/uncategorised/RelationshipPutSchema.ts index 4d2438eea..563e46dcd 100644 --- a/src/schemas/uncategorised/RelationshipPutSchema.ts +++ b/src/schemas/uncategorised/RelationshipPutSchema.ts @@ -25,4 +25,4 @@ export enum RelationshipType { incoming = 3, blocked = 2, friends = 1, -} \ No newline at end of file +} diff --git a/src/schemas/uncategorised/SettingsProtoUpdateSchema.ts b/src/schemas/uncategorised/SettingsProtoUpdateSchema.ts index 2b930bc0f..a7e884e16 100644 --- a/src/schemas/uncategorised/SettingsProtoUpdateSchema.ts +++ b/src/schemas/uncategorised/SettingsProtoUpdateSchema.ts @@ -44,4 +44,4 @@ export interface SettingsProtoUpdateJsonSchema { // export interface SettingsProtoUpdateTestSettingsSchema { // settings: {}; // required_data_version?: number; -// } \ No newline at end of file +// } diff --git a/src/schemas/uncategorised/UploadAttachmentRequestSchema.ts b/src/schemas/uncategorised/UploadAttachmentRequestSchema.ts index 60bf89f6c..0ad3a7cfb 100644 --- a/src/schemas/uncategorised/UploadAttachmentRequestSchema.ts +++ b/src/schemas/uncategorised/UploadAttachmentRequestSchema.ts @@ -16,7 +16,6 @@ along with this program. If not, see . */ - export interface UploadAttachmentRequestSchema { files: UploadAttachmentRequest[]; } diff --git a/src/schemas/uncategorised/UserGuildSettingsSchema.ts b/src/schemas/uncategorised/UserGuildSettingsSchema.ts index d0fe24fc5..20de7e5fa 100644 --- a/src/schemas/uncategorised/UserGuildSettingsSchema.ts +++ b/src/schemas/uncategorised/UserGuildSettingsSchema.ts @@ -19,8 +19,7 @@ import { ChannelOverride, UserGuildSettings } from "@spacebar/schemas"; // This sucks. I would use a DeepPartial, my own or typeorms, but they both generate inncorect schema -export interface UserGuildSettingsSchema - extends Partial> { +export interface UserGuildSettingsSchema extends Partial> { channel_overrides?: { [channel_id: string]: ChannelOverride; }; diff --git a/src/schemas/uncategorised/WebAuthnSchema.ts b/src/schemas/uncategorised/WebAuthnSchema.ts index 3f5e0da7b..ada20de1f 100644 --- a/src/schemas/uncategorised/WebAuthnSchema.ts +++ b/src/schemas/uncategorised/WebAuthnSchema.ts @@ -28,9 +28,7 @@ export interface CreateWebAuthnCredentialSchema { ticket: string; } -export type WebAuthnPostSchema = - | GenerateWebAuthnCredentialsSchema - | CreateWebAuthnCredentialSchema; +export type WebAuthnPostSchema = GenerateWebAuthnCredentialsSchema | CreateWebAuthnCredentialSchema; export interface WebAuthnTotpSchema { code: string; diff --git a/src/schemas/uncategorised/WebhookExecuteSchema.ts b/src/schemas/uncategorised/WebhookExecuteSchema.ts index d95606c37..4957c02d3 100644 --- a/src/schemas/uncategorised/WebhookExecuteSchema.ts +++ b/src/schemas/uncategorised/WebhookExecuteSchema.ts @@ -16,11 +16,8 @@ along with this program. If not, see . */ -import { Embed } from "@spacebar/schemas" -import { - MessageCreateAttachment, - PollCreationSchema, -} from "./MessageCreateSchema"; +import { Embed } from "@spacebar/schemas"; +import { MessageCreateAttachment, PollCreationSchema } from "./MessageCreateSchema"; export interface WebhookExecuteSchema { content?: string; diff --git a/src/util/util/DateBuilder.ts b/src/util/util/DateBuilder.ts index e9c623a90..cb71a3383 100644 --- a/src/util/util/DateBuilder.ts +++ b/src/util/util/DateBuilder.ts @@ -89,4 +89,4 @@ export class DateBuilder { buildTimestamp() { return this.date.getTime(); } -} \ No newline at end of file +} diff --git a/src/util/util/ElapsedTime.test.ts b/src/util/util/ElapsedTime.test.ts index 012ecfafe..dc9a82e05 100644 --- a/src/util/util/ElapsedTime.test.ts +++ b/src/util/util/ElapsedTime.test.ts @@ -75,4 +75,4 @@ test("ElapsedTime should return correct hours", () => { test("ElapsedTime should return correct days", () => { const db = new ElapsedTime(172800000000000n); // 2 days assert.equal(db.days, 2); -}); \ No newline at end of file +}); diff --git a/src/util/util/ElapsedTime.ts b/src/util/util/ElapsedTime.ts index 08f246a1a..e87b886ee 100644 --- a/src/util/util/ElapsedTime.ts +++ b/src/util/util/ElapsedTime.ts @@ -81,4 +81,4 @@ export class ElapsedTime { return `${daysPart}${hoursPart}:${minutesPart}:${secondsPart}.${millisecondsPart}${microsecondsPart}${nanosecondsPart}`; } -} \ No newline at end of file +} diff --git a/src/util/util/Token.ts b/src/util/util/Token.ts index cc19d85e5..e6dff7631 100644 --- a/src/util/util/Token.ts +++ b/src/util/util/Token.ts @@ -171,7 +171,7 @@ export async function generateToken(id: string, isAdminSession: boolean = false) is_admin_session: isAdminSession, client_status: {}, status: "online", - client_info: { }, + client_info: {}, }); } while (await Session.findOne({ where: { session_id: newSession.session_id } }));