Skip to content
Open
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
5 changes: 5 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"semi": true,
"singleQuote": true,
"trailingComma": "none"
}
8 changes: 4 additions & 4 deletions bin/deletecmd.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
require('dotenv').config();
import { Routes, REST } from "discord.js";
import logger from "../src/utilities/Logger";
import { Routes, REST } from 'discord.js';
import logger from '../src/utilities/Logger';
const cmdToDelete = '1478498588362277006';

const rest = new REST({ version: '10' }).setToken(process.env.BOT_TOKEN!);

try {
logger.info(`Attempting to delete the command /${cmdToDelete} ...`);
rest.delete(Routes.applicationCommand(process.env.APP_ID!, cmdToDelete));
logger.info('... Successfully deleted the command')
logger.info('... Successfully deleted the command');
} catch (err) {
throw err;
}
}
35 changes: 21 additions & 14 deletions bin/registercmds.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Routes, REST } from "discord.js";
import { readdirSync } from "fs";
import { Routes, REST } from 'discord.js';
import { readdirSync } from 'fs';
import path from 'path';
import SlashCommand from "../src/structures/SlashCommand";
import logger from "../src/utilities/Logger";
import SlashCommand from '../src/structures/SlashCommand';
import logger from '../src/utilities/Logger';
require('dotenv').config();
const commandDirectory = './src/commands/';

Expand All @@ -15,29 +15,36 @@ for (const file of commandFiles) {
const command = require(fullPath);
const Module = new command.default();
if (!(Module instanceof SlashCommand)) continue;
const isGlobal = Module.isGlobalCommand();
const commandData = Module.getData();
if (isGlobal) {
globalCommandArray.push(commandData.toJSON());
if (Module.isGlobalCommand) {
globalCommandArray.push(Module.data.toJSON());
} else {
commandArray.push(commandData.toJSON());
commandArray.push(Module.data.toJSON());
}
}

const rest = new REST({ version: '10' }).setToken(process.env.BOT_TOKEN!);

try {
logger.info(`Attempting to register ${commandArray.length} server commands...`);
rest.put(Routes.applicationGuildCommands(process.env.APP_ID!, process.env.GUILD_ID!), { body: commandArray });
logger.info(
`Attempting to register ${commandArray.length} server commands...`
);
rest.put(
Routes.applicationGuildCommands(process.env.APP_ID!, process.env.GUILD_ID!),
{ body: commandArray }
);
logger.info('Successfully registered commands!');
} catch (err) {
throw err;
}

try {
logger.info(`Attempting to register ${globalCommandArray.length} global commands...`);
rest.put(Routes.applicationCommands(process.env.APP_ID!), { body: globalCommandArray });
logger.info(
`Attempting to register ${globalCommandArray.length} global commands...`
);
rest.put(Routes.applicationCommands(process.env.APP_ID!), {
body: globalCommandArray
});
logger.info('Successfully registered commands!');
} catch (err) {
throw err;
}
}
193 changes: 193 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
import typescriptEslint from '@typescript-eslint/eslint-plugin'
import stylistic from '@stylistic/eslint-plugin'
import tsParser from '@typescript-eslint/parser'
import globals from 'globals'

export default [
{
files: ['src/**/*.ts'],

plugins: {
'@typescript-eslint': typescriptEslint,
'@stylistic': stylistic
},

languageOptions: {
globals: {
...globals.node
},

parser: tsParser,
ecmaVersion: 13,
sourceType: 'module',

parserOptions: {
ecmaFeatures: {
impliedStrict: true
},

project: ['./tsconfig.json']
}
},

rules: {
'@typescript-eslint/array-type': [
'error',
{
default: 'array',
readonly: 'array'
}
],

'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/ban-ts-comment': 'error',
'@typescript-eslint/ban-tslint-comment': 'error',
'@typescript-eslint/class-literal-property-style': ['error', 'fields'],
'@stylistic/comma-dangle': ['error'],
'@typescript-eslint/consistent-indexed-object-style': ['error', 'record'],
'@typescript-eslint/consistent-type-imports': [
'error',
{
fixStyle: 'inline-type-imports',
},
],
'@typescript-eslint/consistent-type-exports': 'error',
'@typescript-eslint/explicit-function-return-type': 'error',
'@stylistic/keyword-spacing': 'error',
'@stylistic/member-delimiter-style': 'error',
'@typescript-eslint/method-signature-style': ['error', 'property'],
'@typescript-eslint/no-array-constructor': 'error',
'@typescript-eslint/no-dupe-class-members': 'error',
'@typescript-eslint/no-empty-interface': 'error',
'@typescript-eslint/no-extra-non-null-assertion': 'error',
'@stylistic/no-extra-parens': 'error',
'@stylistic/no-extra-semi': 'error',
'@typescript-eslint/no-extraneous-class': 'error',
'@typescript-eslint/no-loss-of-precision': 'error',

'@typescript-eslint/no-misused-promises': [
'error',
{
checksConditionals: true,
checksVoidReturn: false
}
],

'@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error',
'@typescript-eslint/no-this-alias': 'error',
'@typescript-eslint/only-throw-error': 'error',
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
'@typescript-eslint/no-useless-empty-export': 'error',
'@typescript-eslint/non-nullable-type-assertion-style': 'error',
'@stylistic/object-curly-spacing': ['error', 'always'],
'@typescript-eslint/prefer-for-of': 'error',
'@typescript-eslint/prefer-includes': 'error',
'@typescript-eslint/prefer-literal-enum-member': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/prefer-reduce-type-parameter': 'error',
'@typescript-eslint/prefer-return-this-type': 'error',
'@typescript-eslint/require-array-sort-compare': 'error',
'@typescript-eslint/restrict-plus-operands': 'error',
'@stylistic/semi': ['error', 'always'],
'@stylistic/semi-spacing': 'error',
'@stylistic/space-before-blocks': 'error',
'@stylistic/type-annotation-spacing': 'error',

'@typescript-eslint/typedef': [
'error',
{
memberVariableDeclaration: true,
parameter: true,
propertyDeclaration: true,
variableDeclaration: false
}
],

'@typescript-eslint/unified-signatures': 'error',
'block-scoped-var': 'error',
'block-spacing': 'error',
camelcase: 'error',
'comma-style': 'error',
'default-case-last': 'error',
'dot-notation': 'error',
'generator-star-spacing': 'error',
'getter-return': 'error',
'implicit-arrow-linebreak': 'error',
indent: ['error', 2],
'key-spacing': 'error',
'new-parens': 'error',
'no-alert': 'error',
'no-class-assign': 'error',
'no-const-assign': 'error',
'no-constructor-return': 'error',
'no-control-regex': 'error',
'no-delete-var': 'error',
'no-dupe-args': 'error',
'no-dupe-else-if': 'error',
'no-dupe-keys': 'error',
'no-duplicate-case': 'error',
'no-else-return': 'error',
'no-empty-pattern': 'error',
'no-eval': 'error',
'no-ex-assign': 'error',
'no-extend-native': 'error',
'no-fallthrough': 'error',
'no-func-assign': 'error',
'no-global-assign': 'error',
'no-import-assign': 'error',
'no-inner-declarations': 'error',
'no-invalid-regexp': 'error',
'no-label-var': 'error',
'no-lonely-if': 'error',
'no-mixed-spaces-and-tabs': 'error',
'no-new': 'error',
'no-new-func': 'error',
'no-new-object': 'error',
'no-new-symbol': 'error',
'no-new-wrappers': 'error',
'no-nonoctal-decimal-escape': 'error',
'no-obj-calls': 'error',
'no-prototype-builtins': 'error',

'no-return-assign': 'error',
'no-self-assign': 'error',
'no-setter-return': 'error',
'no-shadow-restricted-names': 'error',
'no-sparse-arrays': 'error',
'no-template-curly-in-string': 'error',
'no-undef-init': 'error',
'no-unneeded-ternary': 'error',
'no-unreachable': 'error',
'no-unsafe-optional-chaining': 'error',
'no-unused-labels': 'error',
'no-useless-call': 'error',
'no-useless-catch': 'error',
'no-useless-computed-key': 'error',
'no-useless-concat': 'error',
'no-useless-escape': 'error',
'no-useless-rename': 'error',
'no-useless-return': 'error',
'no-var': 'error',
'no-whitespace-before-property': 'error',
'no-with': 'error',
'object-shorthand': 'error',
'operator-assignment': 'error',
'prefer-arrow-callback': 'error',
'prefer-const': 'error',
'prefer-exponentiation-operator': 'error',
'prefer-object-has-own': 'error',
'prefer-promise-reject-errors': 'error',
'prefer-rest-params': 'error',
'prefer-spread': 'error',
'prefer-template': 'error',
'require-yield': 'error',
strict: 'error',
'switch-colon-spacing': 'error',
'template-curly-spacing': 'error',
'use-isnan': 'error',
'valid-typeof': 'error',
'yield-star-spacing': 'error'
}
}
]
Loading