Merge branch 'dev' into 'main'

Dev

See merge request illegitimate/illegitimate-bot!268
This commit is contained in:
2024-08-24 21:06:04 +00:00
14 changed files with 165 additions and 157 deletions

View File

@@ -16,77 +16,87 @@ const compat = new FlatCompat({
allConfig: js.configs.all allConfig: js.configs.all
}) })
export default [{ export default [
ignores: ["**/node_modules", "**/dist"], {
}, ...compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended"), { ignores: ["**/node_modules", "**/dist"]
plugins: {
"@typescript-eslint": typescriptEslint,
}, },
...compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended"),
languageOptions: { {
globals: { plugins: {
...globals.node, "@typescript-eslint": typescriptEslint,
...globals.browser,
}, },
parser: tsParser, languageOptions: {
ecmaVersion: "latest", globals: {
sourceType: "module", ...globals.node,
}, ...globals.browser,
},
rules: { parser: tsParser,
indent: ["error", 4, { ecmaVersion: "latest",
SwitchCase: 1, sourceType: "module",
}],
"linebreak-style": ["error", "unix"],
quotes: ["warn", "double"],
semi: ["error", "never"],
"no-unused-vars": "off",
"prefer-const": "warn",
"no-var": "error",
"no-multiple-empty-lines": ["error", {
max: 2,
maxEOF: 1,
maxBOF: 0,
}],
"no-lonely-if": "error",
"no-empty-function": "error",
"no-inline-comments": "error",
"no-trailing-spaces": ["error"],
"arrow-spacing": ["warn", {
before: true,
after: true,
}],
"space-before-function-paren": ["error", {
anonymous: "never",
named: "never",
asyncArrow: "always",
}],
"comma-spacing": "error",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": ["warn", {
vars: "all",
args: "after-used",
ignoreRestSiblings: false,
}],
"@typescript-eslint/no-empty-object-type": "off",
"@typescript-eslint/no-require-imports": "off",
},
}, {
languageOptions: {
globals: {
...globals.node,
}, },
ecmaVersion: 5, rules: {
sourceType: "commonjs", indent: ["error", 4, {
}, SwitchCase: 1,
}] }],
"linebreak-style": ["error", "unix"],
quotes: ["warn", "double"],
semi: ["error", "never"],
"no-unused-vars": "off",
"prefer-const": "warn",
"no-var": "error",
"no-multiple-empty-lines": ["error", {
max: 2,
maxEOF: 1,
maxBOF: 0,
}],
"no-lonely-if": "error",
"no-empty-function": "error",
"no-inline-comments": "error",
"no-trailing-spaces": ["error"],
"arrow-spacing": ["warn", {
before: true,
after: true,
}],
"space-before-function-paren": ["error", {
anonymous: "never",
named: "never",
asyncArrow: "always",
}],
"comma-spacing": "error",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": ["warn", {
vars: "all",
args: "after-used",
ignoreRestSiblings: false,
}],
"@typescript-eslint/no-empty-object-type": "off",
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/ban-ts-comment": ["error", {
"ts-expect-error": "allow-with-description",
"ts-ignore": "allow-with-description",
"ts-nocheck": "allow-with-description",
"ts-check": "allow-with-description",
}],
},
}, {
languageOptions: {
globals: {
...globals.node,
},
ecmaVersion: 5,
sourceType: "commonjs",
},
}
]

View File

@@ -1,4 +1,5 @@
{ {
"$schema": "https://json.schemastore.org/nodemon.json",
"restartable": "rs", "restartable": "rs",
"ignore": [ "ignore": [
".git", ".git",

View File

@@ -1,4 +1,5 @@
{ {
"$schema": "https://json.schemastore.org/nodemon.json",
"ignore": [ "ignore": [
".git", ".git",
"node_modules", "node_modules",
@@ -9,4 +10,4 @@
}, },
"ext": "ts", "ext": "ts",
"exec": "yarn build && yarn start" "exec": "yarn build && yarn start"
} }

View File

@@ -1,4 +1,5 @@
{ {
"$schema": "https://json.schemastore.org/nodemon.json",
"restartable": "rs", "restartable": "rs",
"ignore": [ "ignore": [
".git", ".git",

View File

@@ -1,70 +1,71 @@
{ {
"name": "illegitimate-bot", "$schema": "https://json.schemastore.org/package.json",
"displayName": "Illegitimate Bot", "name": "illegitimate-bot",
"version": "1.0.0", "displayName": "Illegitimate Bot",
"description": "", "version": "1.0.0",
"main": "src/index.ts", "description": "",
"type": "module", "main": "src/index.ts",
"repository": { "type": "module",
"type": "git", "repository": {
"url": "https://gitlab.com/illegitimate/illegitimate-bot" "type": "git",
}, "url": "https://gitlab.com/illegitimate/illegitimate-bot"
"homepage": "https://gitlab.com/illegitimate/illegitimate-bot", },
"scripts": { "homepage": "https://gitlab.com/illegitimate/illegitimate-bot",
"start": "node dist/index.js", "scripts": {
"build": "swc src -d dist --strip-leading-paths", "start": "node dist/index.js",
"watch": "swc src -d dist --strip-leading-paths --watch", "build": "swc src -d dist --strip-leading-paths",
"dev": "nodemon --config nodemon-swc.json", "watch": "swc src -d dist --strip-leading-paths --watch",
"dev:conc": "conc --names \"SWC,BOT\" --prefix-colors \"blue, magenta\" \"yarn watch\" \"yarn dev:js\"", "dev": "nodemon --config nodemon-swc.json",
"dev:ts": "nodemon --config nodemon.json src/index.ts", "dev:conc": "conc --names \"SWC,BOT\" --prefix-colors \"blue, magenta\" \"yarn watch\" \"yarn dev:js\"",
"dev:js": "nodemon --config nodemon-js.json dist/index.js", "dev:ts": "nodemon --config nodemon.json src/index.ts",
"check": "tsc --noEmit", "dev:js": "nodemon --config nodemon-js.json dist/index.js",
"lint": "eslint", "check": "tsc --noEmit",
"lint:fix": "eslint --fix", "lint": "eslint",
"push:prod": "cross-env NODE_PATH=src/ \"ts-node scripts/deploy-commands.ts\"", "lint:fix": "eslint --fix",
"push:dev": "cross-env NODE_PATH=src/ \"ts-node scripts/dev-deploy.ts\"", "push:prod": "cross-env NODE_PATH=src/ \"ts-node scripts/deploy-commands.ts\"",
"delete:dev": "ts-node scripts/delete-commands.ts" "push:dev": "cross-env NODE_PATH=src/ \"ts-node scripts/dev-deploy.ts\"",
}, "delete:dev": "ts-node scripts/delete-commands.ts"
"author": "Taken", },
"license": "GPL-3.0-only", "author": "Taken",
"dependencies": { "license": "GPL-3.0-only",
"@discord-player/extractor": "^4.5.1", "dependencies": {
"@evan/opus": "^1.0.3", "@discord-player/extractor": "^4.5.1",
"anilist": "^0.12.4", "@evan/opus": "^1.0.3",
"axios": "^1.7.5", "anilist": "^0.12.4",
"chalk": "^5.3.0", "axios": "^1.7.5",
"cron": "^3.1.7", "chalk": "^5.3.0",
"discord-player": "^6.7.1", "cron": "^3.1.7",
"discord-player-youtubei": "^1.2.6", "discord-player": "^6.7.1",
"discord.js": "^14.15.3", "discord-player-youtubei": "^1.2.6",
"dotenv": "^16.4.5", "discord.js": "^14.15.3",
"ioredis": "^5.4.1", "dotenv": "^16.4.5",
"mongoose": "^8.5.3", "ioredis": "^5.4.1",
"ms": "^2.1.3", "mongoose": "^8.5.3",
"pg": "^8.12.0", "ms": "^2.1.3",
"pg-hstore": "^2.3.4", "pg": "^8.12.0",
"pretty-ms": "^9.1.0", "pg-hstore": "^2.3.4",
"sequelize": "^6.37.3", "pretty-ms": "^9.1.0",
"youtube-ext": "^1.1.25" "sequelize": "^6.37.3",
}, "youtube-ext": "^1.1.25"
"devDependencies": { },
"@eslint/eslintrc": "^3.1.0", "devDependencies": {
"@eslint/js": "^9.9.0", "@eslint/eslintrc": "^3.1.0",
"@swc/cli": "^0.4.0", "@eslint/js": "^9.9.0",
"@swc/core": "^1.7.14", "@swc/cli": "^0.4.0",
"@types/ms": "^0.7.34", "@swc/core": "^1.7.14",
"@types/node": "^22.5.0", "@types/ms": "^0.7.34",
"@types/pg": "^8", "@types/node": "^22.5.0",
"@typescript-eslint/eslint-plugin": "^8.2.0", "@types/pg": "^8",
"@typescript-eslint/parser": "^8.2.0", "@typescript-eslint/eslint-plugin": "^8.2.0",
"chokidar": "^3.6.0", "@typescript-eslint/parser": "^8.2.0",
"concurrently": "^8.2.2", "chokidar": "^3.6.0",
"cross-env": "^7.0.3", "concurrently": "^8.2.2",
"eslint": "^9.9.0", "cross-env": "^7.0.3",
"globals": "^15.9.0", "eslint": "^9.9.0",
"sqlite3": "^5.1.7", "globals": "^15.9.0",
"ts-node": "^10.9.2", "sqlite3": "^5.1.7",
"typescript": "^5.5.4" "ts-node": "^10.9.2",
}, "typescript": "^5.5.4"
"packageManager": "yarn@4.4.0" },
"packageManager": "yarn@4.4.0"
} }

View File

@@ -15,8 +15,7 @@ export default async function loadAutocompleteEvents(client: Client, ft: FileTyp
for (const file of autocompleteFiles) { for (const file of autocompleteFiles) {
const filePath = path.join(autocompletePath, file) const filePath = path.join(autocompletePath, file)
const { default: autocompleteImport } = await import("file://" + filePath) const { default: autocomplete } = await import("file://" + filePath) as { default: IAutocomplete }
const autocomplete: IAutocomplete = autocompleteImport
if ("name" in autocomplete && "execute" in autocomplete) { if ("name" in autocomplete && "execute" in autocomplete) {
client.autocomplete.set(autocomplete.name, autocomplete) client.autocomplete.set(autocomplete.name, autocomplete)

View File

@@ -15,8 +15,7 @@ export default async function loadButtonEvents(client: Client, ft: FileType) {
for (const file of btnFiles) { for (const file of btnFiles) {
const filePath = path.join(btnPath, file) const filePath = path.join(btnPath, file)
const { default: btnImport } = await import("file://" + filePath) const { default: btn } = await import("file://" + filePath) as { default: IButton }
const btn: IButton = btnImport
if ("name" in btn && "execute" in btn) { if ("name" in btn && "execute" in btn) {
client.buttons.set(btn.name, btn) client.buttons.set(btn.name, btn)

View File

@@ -15,8 +15,7 @@ export default async function loadSlashCommandsEvents(client: Client, ft: FileTy
for (const file of cmdFiles) { for (const file of cmdFiles) {
const filePath = path.join(cmdPath, file) const filePath = path.join(cmdPath, file)
const { default: cmdImport } = await import("file://" + filePath) const { default: cmd } = await import("file://" + filePath) as { default: ICommand }
const cmd: ICommand = cmdImport
if ("data" in cmd && "execute" in cmd) { if ("data" in cmd && "execute" in cmd) {
client.commands.set(cmd.data.name, cmd) client.commands.set(cmd.data.name, cmd)

View File

@@ -15,8 +15,7 @@ export default async function loadContextMenuEvents(client: Client, ft: FileType
for (const file of contextMenuFiles) { for (const file of contextMenuFiles) {
const filePath = path.join(contextMenuPath, file) const filePath = path.join(contextMenuPath, file)
const { default: cmdImport } = await import("file://" + filePath) const { default: cmd } = await import("file://" + filePath) as { default: IContextMenu }
const cmd: IContextMenu = cmdImport
if ("data" in cmd && "execute" in cmd) { if ("data" in cmd && "execute" in cmd) {
client.contextmenus.set(cmd.data.name, cmd) client.contextmenus.set(cmd.data.name, cmd)

View File

@@ -10,8 +10,7 @@ export default async function loadCronEvents() {
for (const file of cronFiles) { for (const file of cronFiles) {
const filePath = path.join(cronPath, file) const filePath = path.join(cronPath, file)
const { default: cronImport } = await import("file://" + filePath) const { default: cron } = await import("file://" + filePath) as { default: ICron }
const cron: ICron = cronImport
const time = const time =
cron.time.seconds + " " + cron.time.seconds + " " +

View File

@@ -11,8 +11,7 @@ export default async function loadEvents(client: Client) {
const eventFiles = fs.readdirSync(path.join(serverDir, eventDir)) const eventFiles = fs.readdirSync(path.join(serverDir, eventDir))
for (const eventFile of eventFiles) { for (const eventFile of eventFiles) {
const eventPath = path.join(serverDir, eventDir, eventFile) const eventPath = path.join(serverDir, eventDir, eventFile)
const { default: eventImport } = await import("file://" + eventPath) const { default: event } = await import("file://" + eventPath) as { default: IEvent }
const event: IEvent = eventImport
if (!event.disabled) { if (!event.disabled) {
client.on(event.event, event.execute) client.on(event.event, event.execute)
} }

View File

@@ -15,8 +15,7 @@ export default async function loadModalEvents(client: Client, ft: FileType) {
for (const file of modalFiles) { for (const file of modalFiles) {
const filePath = path.join(modalPath, file) const filePath = path.join(modalPath, file)
const { default: modalImport } = await import("file://" + filePath) const { default: modal } = await import("file://" + filePath) as { default: IModal }
const modal: IModal = modalImport
if ("name" in modal && "execute" in modal) { if ("name" in modal && "execute" in modal) {
client.modals.set(modal.name, modal) client.modals.set(modal.name, modal)

View File

@@ -44,11 +44,11 @@ class Illegitimate {
redis.on("ready", () => { redis.on("ready", () => {
console.log(color("Connected to Redis", "green")) console.log(color("Connected to Redis", "green"))
}) })
// if (process.env.NODE_ENV === "dev") { if (process.env.NODE_ENV === "dev") {
// sequelize.sync().then(() => { sequelize.sync().then(() => {
// console.log(color("Synced the db [dev]", "green")) console.log(color("Synced the db [dev]", "green"))
// }) })
// } }
// connect(env.prod.mongoURI!, {}).then(() => { // connect(env.prod.mongoURI!, {}).then(() => {
// console.log(color("Connected to MongoDB", "green")) // console.log(color("Connected to MongoDB", "green"))
// }) // })

View File

@@ -1,4 +1,5 @@
{ {
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": { "compilerOptions": {
"target": "ES2022", "target": "ES2022",
"module": "ES2022", "module": "ES2022",
@@ -24,4 +25,4 @@
}, },
"include": ["src"], "include": ["src"],
"exclude": ["node_modules"] "exclude": ["node_modules"]
} }