Compare commits

..

No commits in common. "6e1cb8c9569fce8da3fb7be50e9d6649dabfafad" and "b7f6a5fe91fb4cdffe3018e1913e8d8aa9e7d4ca" have entirely different histories.

5 changed files with 15 additions and 26 deletions

View file

@ -12,7 +12,6 @@ RUN npx prisma generate
# Typescript compiling
COPY tsconfig.json .
COPY src ./src
COPY scripts ./scripts
RUN npx tsc
# Run the app

View file

@ -6,7 +6,7 @@
"scripts": {
"start": "tsc && node dist/src/index.js",
"test": "echo \"Error: no test specified\" && exit 1",
"publishCommands": "tsc && node dist/scripts/pushCommands.js"
"publishCommands": "tsc && node dist/src/scripts/pushCommands.js"
},
"author": "Wroclaw",
"license": "MIT",

View file

@ -4,13 +4,13 @@ import Command from "../command";
import { config } from "../index";
export default class MyLimit extends Command implements Command {
name = "check-quota";
description = "Checks your quota and usage";
name = "check-limit";
description = "Checks your limit and usage";
type = ApplicationCommandType.ChatInput;
options: APIApplicationCommandOption[] = [
{
name: "recovery-for",
description: "Get the recovery time for given quota units count (default: until can use the bot or 1)",
description: "Calculate the limit recovery time for given message count (default: amount required to use the bot again or 1)",
type: ApplicationCommandOptionType.Integer,
required: false,
},
@ -18,7 +18,6 @@ export default class MyLimit extends Command implements Command {
name: "ephemeral",
description: "if true, only you can see the response (default true)",
type: ApplicationCommandOptionType.Boolean,
required: false,
}
];

View file

@ -1,29 +1,23 @@
// https://discordjs.guide/creating-your-bot/command-deployment.html#guild-commands
import { REST, RESTGetAPIOAuth2CurrentApplicationResult, RESTPostAPIApplicationCommandsJSONBody, Routes } from "discord.js";
import { config } from "../src/index";
import { config } from "../index";
import requireDirectory from "require-directory";
import Command from "../src/command";
import Command from "../command";
const post: RESTPostAPIApplicationCommandsJSONBody[] = [];
const guildId = process.argv.slice(2)[0];
const importedCommands = requireDirectory(module, "../src/commands");
for (const obj in importedCommands) {
try {
const allExports = importedCommands[obj] as {default: unknown};
const defaultExport = allExports.default;
requireDirectory<{default: Command}, void>(module, "../commands", {
visit: function (obj) {
console.log(obj);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const constructedExport = new defaultExport() as unknown;
if (!(constructedExport instanceof Command)) throw new Error(`${obj}'s default does not extends Command`);
post.push(constructedExport.toRESTPostApplicationCommands());
} catch (e) {
console.error(e);
}
}
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
post.push(new obj.default().toRESTPostApplicationCommands());
},
});
const rest = new REST().setToken(config.tokens.Discord);
@ -43,8 +37,6 @@ const rest = new REST().setToken(config.tokens.Discord);
);
}
console.log("Refreshed successfully");
process.exit(0);
})().catch( e => {
console.error(e);
process.exit(1);
});

View file

@ -1,7 +1,6 @@
{
"include": [
"./src/**/*",
"./scripts/**/*"
"./src/**/*"
],
"compilerOptions": {
"target": "ES2022",