mirror of
https://github.com/spacebarchat/server.git
synced 2026-07-18 09:36:16 +00:00
Prettier 2
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -26,4 +26,4 @@
|
||||
* number of ms since Discord epoch worker pid increment
|
||||
* ```
|
||||
*/
|
||||
export type Snowflake = string;
|
||||
export type Snowflake = string;
|
||||
|
||||
@@ -2,4 +2,4 @@ export enum WebhookType {
|
||||
Incoming = 1,
|
||||
ChannelFollower = 2,
|
||||
Application = 3,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,4 +6,4 @@ export enum TeamMemberRole {
|
||||
ADMIN = "admin",
|
||||
DEVELOPER = "developer",
|
||||
READ_ONLY = "read_only",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
}
|
||||
export interface AutomodRuleActionMetadata {}
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
|
||||
@@ -10,4 +10,4 @@ export class RoleColors {
|
||||
tertiary_color: this.tertiary_color ?? undefined,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<VoiceState, PublicVoiceStateKeys>;
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ export enum MessageType {
|
||||
UNHANDLED = 255,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* https://docs.discord.food/resources/message#partial-message-structure
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { PartialEmoji } from "@spacebar/schemas"
|
||||
import { PartialEmoji } from "@spacebar/schemas";
|
||||
|
||||
export interface Poll {
|
||||
question: PollMedia;
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
import { ConnectedAccount } from "@spacebar/util";
|
||||
|
||||
export type PublicConnectedAccount = Pick<
|
||||
ConnectedAccount,
|
||||
"name" | "type" | "verified"
|
||||
>;
|
||||
export type PublicConnectedAccount = Pick<ConnectedAccount, "name" | "type" | "verified">;
|
||||
|
||||
@@ -92,4 +92,4 @@ export const PublicMemberProjection: PublicMemberKeys[] = [
|
||||
export type PublicMember = Omit<Pick<Member, PublicMemberKeys>, "roles"> & {
|
||||
user: PublicUser;
|
||||
roles: string[]; // only role ids not objects
|
||||
};
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -19,4 +19,4 @@ export * from "./ConnectedAccount";
|
||||
export * from "./InstanceUserDeleteSchema";
|
||||
export * from "./Member";
|
||||
export * from "./User";
|
||||
export * from "./UserSettings";
|
||||
export * from "./UserSettings";
|
||||
|
||||
@@ -19,6 +19,4 @@
|
||||
import { APIErrorResponse } from "./APIErrorResponse";
|
||||
import { CaptchaRequiredResponse } from "./CaptchaRequiredResponse";
|
||||
|
||||
export type APIErrorOrCaptchaResponse =
|
||||
| CaptchaRequiredResponse
|
||||
| APIErrorResponse;
|
||||
export type APIErrorOrCaptchaResponse = CaptchaRequiredResponse | APIErrorResponse;
|
||||
|
||||
@@ -132,7 +132,7 @@ export interface Classification {
|
||||
|
||||
export enum GuildMemberType {
|
||||
OWNER = 1,
|
||||
MEMBER = 2
|
||||
MEMBER = 2,
|
||||
}
|
||||
|
||||
export interface GuildMetadata {
|
||||
|
||||
@@ -16,6 +16,6 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { PartialMessage } from "@spacebar/schemas"
|
||||
import { PartialMessage } from "@spacebar/schemas";
|
||||
|
||||
export type DmMessagesResponseSchema = PartialMessage[];
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
import { GuildWelcomeScreen } from "@spacebar/util";
|
||||
import { GuildUpdateSchema } from "@spacebar/schemas"
|
||||
import { GuildUpdateSchema } from "@spacebar/schemas";
|
||||
|
||||
export interface GuildCreateResponse extends Omit<GuildUpdateSchema, "name"> {
|
||||
id: string;
|
||||
|
||||
@@ -16,10 +16,7 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {
|
||||
Attachment,
|
||||
Role,
|
||||
} from "../../util/entities";
|
||||
import { Attachment, Role } from "../../util/entities";
|
||||
import { ActionRowComponent, Embed, MessageType, Poll, PublicUser } from "@spacebar/schemas";
|
||||
|
||||
export interface GuildMessagesSearchMessage {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -18,4 +18,4 @@
|
||||
|
||||
import { Message } from "@spacebar/util";
|
||||
|
||||
export type PreloadMessagesResponseSchema = Message[];
|
||||
export type PreloadMessagesResponseSchema = Message[];
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
export interface UploadAttachmentResponseSchema {
|
||||
attachments: UploadAttachmentResponse[];
|
||||
}
|
||||
|
||||
@@ -16,33 +16,19 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<Member, "banner" | "bio" | "guild_id"> & {
|
||||
accent_color: null; // TODO
|
||||
};
|
||||
|
||||
export type UserProfile = Pick<
|
||||
User,
|
||||
"bio" | "accent_color" | "banner" | "pronouns" | "theme_colors"
|
||||
>;
|
||||
export type UserProfile = Pick<User, "bio" | "accent_color" | "banner" | "pronouns" | "theme_colors">;
|
||||
|
||||
export interface UserProfileResponse {
|
||||
user: PublicUser;
|
||||
|
||||
@@ -17,8 +17,4 @@
|
||||
*/
|
||||
import { User } from "@spacebar/util";
|
||||
|
||||
export type UserRelationsResponse = (Pick<User, "id"> &
|
||||
Pick<User, "username"> &
|
||||
Pick<User, "discriminator"> &
|
||||
Pick<User, "avatar"> &
|
||||
Pick<User, "public_flags">)[];
|
||||
export type UserRelationsResponse = (Pick<User, "id"> & Pick<User, "username"> & Pick<User, "discriminator"> & Pick<User, "avatar"> & Pick<User, "public_flags">)[];
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { PublicUser, RelationshipType } from "@spacebar/schemas"
|
||||
import { PublicUser, RelationshipType } from "@spacebar/schemas";
|
||||
|
||||
export interface UserRelationshipsResponse {
|
||||
id: string;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,4 +42,4 @@ export enum ReadStateFlags {
|
||||
IS_GUILD_CHANNEL = 1 << 0,
|
||||
IS_THREAD = 1 << 1,
|
||||
IS_MENTION_LOW_IMPORTANCE = 1 << 2,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,4 +25,4 @@ export enum RelationshipType {
|
||||
incoming = 3,
|
||||
blocked = 2,
|
||||
friends = 1,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,4 +44,4 @@ export interface SettingsProtoUpdateJsonSchema {
|
||||
// export interface SettingsProtoUpdateTestSettingsSchema {
|
||||
// settings: {};
|
||||
// required_data_version?: number;
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
export interface UploadAttachmentRequestSchema {
|
||||
files: UploadAttachmentRequest[];
|
||||
}
|
||||
|
||||
@@ -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<Omit<UserGuildSettings, "channel_overrides">> {
|
||||
export interface UserGuildSettingsSchema extends Partial<Omit<UserGuildSettings, "channel_overrides">> {
|
||||
channel_overrides?: {
|
||||
[channel_id: string]: ChannelOverride;
|
||||
};
|
||||
|
||||
@@ -28,9 +28,7 @@ export interface CreateWebAuthnCredentialSchema {
|
||||
ticket: string;
|
||||
}
|
||||
|
||||
export type WebAuthnPostSchema =
|
||||
| GenerateWebAuthnCredentialsSchema
|
||||
| CreateWebAuthnCredentialSchema;
|
||||
export type WebAuthnPostSchema = GenerateWebAuthnCredentialsSchema | CreateWebAuthnCredentialSchema;
|
||||
|
||||
export interface WebAuthnTotpSchema {
|
||||
code: string;
|
||||
|
||||
@@ -16,11 +16,8 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
@@ -89,4 +89,4 @@ export class DateBuilder {
|
||||
buildTimestamp() {
|
||||
return this.date.getTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -81,4 +81,4 @@ export class ElapsedTime {
|
||||
|
||||
return `${daysPart}${hoursPart}:${minutesPart}:${secondsPart}.${millisecondsPart}${microsecondsPart}${nanosecondsPart}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 } }));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user