Skip to content
This repository was archived by the owner on Oct 9, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ model originalMessages {
authorId String
reactions Json? // eg. {"👎": ["9893820930928", "39283902803982"]} "emoji": userId[] basically
createdAt DateTime
mode Int @default(0)
broadcastMsgs broadcastedMessages[] // Ids of messages that were broadcasted to other hubs
messageReference String? @db.String // id of the original message this message is replying to
hub hubs? @relation(fields: [hubId], references: [id])
Expand All @@ -127,6 +128,7 @@ model broadcastedMessages {
messageId String @id @map("_id")
channelId String
createdAt DateTime
mode Int @default(0)
originalMsg originalMessages @relation(fields: [originalMsgId], references: [messageId])
originalMsgId String @db.String
}
Expand Down
16 changes: 13 additions & 3 deletions scripts/genLocaleTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import { readFileSync, writeFileSync } from 'fs';
import yaml from 'js-yaml';
import { dirname, resolve } from 'path';
import prettier from 'prettier';
import { createPrinter, factory, NewLineKind, NodeFlags, SyntaxKind } from 'typescript';
import { fileURLToPath } from 'url';
import prettier from 'prettier';

// Helper function to get the current directory name in ES modules
const __filename = fileURLToPath(import.meta.url);
Expand Down Expand Up @@ -86,9 +86,19 @@ const sourceFile = factory.createSourceFile(
// Print the TypeScript code to a string
const printer = createPrinter({ newLine: NewLineKind.LineFeed });
const formattedTypes = await formatWithPrettier(printer.printFile(sourceFile));
const errorLocaleKeysExtra = 'export type ErrorLocaleKeys = Extract<keyof TranslationKeys, `errors.${string}`>;'

const output = `/*
WARNING: THIS IS AN AUTOGENERATED FILE. DO NOT EDIT IT DIRECTLY.
Update it through the script located in scripts/genLocaleTypings.js instead.
*/

${formattedTypes}
${errorLocaleKeysExtra}
`

// Write the .d.ts file
const outputFilePath = resolve(__dirname, '..', 'src/typings/en.d.ts');
writeFileSync(outputFilePath, formattedTypes);
const outputFilePath = resolve(__dirname, '..', 'src/typings/locale.d.ts');
writeFileSync(outputFilePath, output);

console.log(`Type definitions for locales written to ${outputFilePath}`);
4 changes: 2 additions & 2 deletions src/commands/context-menu/deleteMsg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default class DeleteMessage extends BaseCommand {
readonly cooldown = 10_000;

async execute(interaction: MessageContextMenuCommandInteraction): Promise<void> {
const isOnCooldown = await this.checkAndSetCooldown(interaction);
const isOnCooldown = await this.checkOrSetCooldown(interaction);
if (isOnCooldown || !interaction.inCachedGuild()) return;

await interaction.deferReply({ ephemeral: true });
Expand Down Expand Up @@ -107,7 +107,7 @@ export default class DeleteMessage extends BaseCommand {
const { targetMessage } = interaction;

const messageContent =
targetMessage.cleanContent ?? targetMessage.embeds.at(0)?.description?.replaceAll('`', '`');
targetMessage.cleanContent ?? targetMessage.embeds.at(0)?.description?.replaceAll('`', '\\`');

const imageUrl =
targetMessage.embeds.at(0)?.image?.url ??
Expand Down
Loading