Merge branch 'dev' into 'main'
Updated scripts to use esm syntax See merge request illegitimate/illegitimate-bot!275
This commit is contained in:
@@ -2,10 +2,7 @@
|
|||||||
"$schema": "https://json.schemastore.org/nodemon.json",
|
"$schema": "https://json.schemastore.org/nodemon.json",
|
||||||
"restartable": "rs",
|
"restartable": "rs",
|
||||||
"ignore": [
|
"ignore": [
|
||||||
".git",
|
"node_modules"
|
||||||
"node_modules",
|
|
||||||
"src",
|
|
||||||
"data"
|
|
||||||
],
|
],
|
||||||
"verbose": true,
|
"verbose": true,
|
||||||
"env": {
|
"env": {
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://json.schemastore.org/nodemon.json",
|
"$schema": "https://json.schemastore.org/nodemon.json",
|
||||||
"ignore": [
|
"ignore": [
|
||||||
".git",
|
"node_modules"
|
||||||
"node_modules",
|
|
||||||
"data"
|
|
||||||
],
|
],
|
||||||
"env": {
|
"env": {
|
||||||
"NODE_ENV": "dev"
|
"NODE_ENV": "dev"
|
||||||
|
|||||||
@@ -2,13 +2,10 @@
|
|||||||
"$schema": "https://json.schemastore.org/nodemon.json",
|
"$schema": "https://json.schemastore.org/nodemon.json",
|
||||||
"restartable": "rs",
|
"restartable": "rs",
|
||||||
"ignore": [
|
"ignore": [
|
||||||
".git",
|
"node_modules"
|
||||||
"node_modules",
|
|
||||||
"data"
|
|
||||||
],
|
],
|
||||||
"verbose": true,
|
"verbose": true,
|
||||||
"env": {
|
"env": {
|
||||||
"NODE_PATH": "src/",
|
|
||||||
"NODE_ENV": "dev",
|
"NODE_ENV": "dev",
|
||||||
"TYPESCRIPT": "true"
|
"TYPESCRIPT": "true"
|
||||||
},
|
},
|
||||||
|
|||||||
31
package.json
31
package.json
@@ -16,16 +16,15 @@
|
|||||||
"build": "swc src -d dist --strip-leading-paths",
|
"build": "swc src -d dist --strip-leading-paths",
|
||||||
"watch": "swc src -d dist --strip-leading-paths --watch",
|
"watch": "swc src -d dist --strip-leading-paths --watch",
|
||||||
"dev": "nodemon --config nodemon-swc.json",
|
"dev": "nodemon --config nodemon-swc.json",
|
||||||
"dev:conc": "conc --names \"SWC,BOT\" --prefix-colors \"blue, magenta\" \"yarn watch\" \"yarn dev:js\"",
|
|
||||||
"dev:ts": "nodemon --config nodemon.json src/index.ts",
|
"dev:ts": "nodemon --config nodemon.json src/index.ts",
|
||||||
"dev:js": "nodemon --config nodemon-js.json dist/index.js",
|
"dev:js": "nodemon --config nodemon-js.json dist/index.js",
|
||||||
"format": "dprint fmt \"**/*.ts\"",
|
"format": "dprint fmt \"**/*.ts\"",
|
||||||
"check": "tsc --noEmit",
|
"check": "tsc --noEmit",
|
||||||
"lint": "eslint",
|
"lint": "eslint",
|
||||||
"lint:fix": "eslint --fix",
|
"lint:fix": "eslint --fix",
|
||||||
"push:prod": "cross-env NODE_PATH=src/ \"ts-node scripts/deploy-commands.ts\"",
|
"push:prod": "tsx scripts/deploy-commands.ts",
|
||||||
"push:dev": "cross-env NODE_PATH=src/ \"ts-node scripts/dev-deploy.ts\"",
|
"push:dev": "tsx scripts/dev-deploy.ts",
|
||||||
"delete:dev": "ts-node scripts/delete-commands.ts"
|
"delete:dev": "tsx scripts/delete-commands.ts"
|
||||||
},
|
},
|
||||||
"author": "Taken",
|
"author": "Taken",
|
||||||
"license": "GPL-3.0-only",
|
"license": "GPL-3.0-only",
|
||||||
@@ -33,15 +32,15 @@
|
|||||||
"@discord-player/extractor": "^4.5.1",
|
"@discord-player/extractor": "^4.5.1",
|
||||||
"@evan/opus": "^1.0.3",
|
"@evan/opus": "^1.0.3",
|
||||||
"anilist": "^0.12.4",
|
"anilist": "^0.12.4",
|
||||||
"axios": "^1.7.5",
|
"axios": "^1.7.7",
|
||||||
"chalk": "^5.3.0",
|
"chalk": "^5.3.0",
|
||||||
"cron": "^3.1.7",
|
"cron": "^3.1.7",
|
||||||
"discord-player": "^6.7.1",
|
"discord-player": "^6.7.1",
|
||||||
"discord-player-youtubei": "^1.2.6",
|
"discord-player-youtubei": "^1.3.1",
|
||||||
"discord.js": "^14.15.3",
|
"discord.js": "^14.16.1",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.4.5",
|
||||||
"ioredis": "^5.4.1",
|
"ioredis": "^5.4.1",
|
||||||
"mongoose": "^8.5.3",
|
"mongoose": "^8.6.1",
|
||||||
"ms": "^2.1.3",
|
"ms": "^2.1.3",
|
||||||
"pg": "^8.12.0",
|
"pg": "^8.12.0",
|
||||||
"pg-hstore": "^2.3.4",
|
"pg-hstore": "^2.3.4",
|
||||||
@@ -51,23 +50,21 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/eslintrc": "^3.1.0",
|
"@eslint/eslintrc": "^3.1.0",
|
||||||
"@eslint/js": "^9.9.0",
|
"@eslint/js": "^9.10.0",
|
||||||
"@swc/cli": "^0.4.0",
|
"@swc/cli": "^0.4.0",
|
||||||
"@swc/core": "^1.7.14",
|
"@swc/core": "^1.7.24",
|
||||||
"@types/ms": "^0.7.34",
|
"@types/ms": "^0.7.34",
|
||||||
"@types/node": "^22.5.0",
|
"@types/node": "^22.5.4",
|
||||||
"@types/pg": "^8",
|
"@types/pg": "^8",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.2.0",
|
"@typescript-eslint/eslint-plugin": "^8.4.0",
|
||||||
"@typescript-eslint/parser": "^8.2.0",
|
"@typescript-eslint/parser": "^8.4.0",
|
||||||
"chokidar": "^3.6.0",
|
"chokidar": "^3.6.0",
|
||||||
"concurrently": "^8.2.2",
|
|
||||||
"cross-env": "^7.0.3",
|
|
||||||
"dprint": "^0.47.2",
|
"dprint": "^0.47.2",
|
||||||
"eslint": "^9.9.0",
|
"eslint": "^9.10.0",
|
||||||
"globals": "^15.9.0",
|
"globals": "^15.9.0",
|
||||||
"sqlite3": "^5.1.7",
|
"sqlite3": "^5.1.7",
|
||||||
"tsx": "^4.19.0",
|
"tsx": "^4.19.0",
|
||||||
"typescript": "^5.5.4"
|
"typescript": "^5.5.4"
|
||||||
},
|
},
|
||||||
"packageManager": "yarn@4.4.0"
|
"packageManager": "yarn@4.4.1"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,16 +3,13 @@ import env from "../src/utils/Env"
|
|||||||
|
|
||||||
const rest = new REST({ version: "10" }).setToken(env.dev.devtoken)
|
const rest = new REST({ version: "10" }).setToken(env.dev.devtoken)
|
||||||
|
|
||||||
async function deleteCommands() {
|
try {
|
||||||
try {
|
console.log("Started deleting application (/) commands.")
|
||||||
console.log("Started deleting application (/) commands.")
|
await rest.put(
|
||||||
await rest.put(
|
Routes.applicationGuildCommands(env.dev.devid, env.dev.guildid),
|
||||||
Routes.applicationGuildCommands(env.dev.devid, env.dev.guildid),
|
{ body: [] }
|
||||||
{ body: [] }
|
)
|
||||||
)
|
console.log("Successfully deleted application (/) commands.")
|
||||||
console.log("Successfully deleted application (/) commands.")
|
} catch (error) {
|
||||||
} catch (error) {
|
console.error(error)
|
||||||
console.error(error)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
deleteCommands()
|
|
||||||
|
|||||||
@@ -10,29 +10,27 @@ const commandFiles = fs.readdirSync("./src/commands").filter(file => file.endsWi
|
|||||||
const contentMenuCommands = fs.readdirSync("./src/commands-contextmenu").filter(file => file.endsWith(".ts"))
|
const contentMenuCommands = fs.readdirSync("./src/commands-contextmenu").filter(file => file.endsWith(".ts"))
|
||||||
|
|
||||||
for (const file of commandFiles) {
|
for (const file of commandFiles) {
|
||||||
const command: ICommand = require(`../src/commands/${file}`)
|
const { default: command } = await import(`../src/commands/${file}`) as { default: ICommand }
|
||||||
commands.push(command.data.toJSON())
|
commands.push(command.data.toJSON())
|
||||||
}
|
}
|
||||||
for (const file of contentMenuCommands) {
|
for (const file of contentMenuCommands) {
|
||||||
const command: ICommand = require(`../src/commands-contextmenu/${file}`)
|
const { default: command } = await import(`../src/commands-contextmenu/${file}`) as { default: ICommand }
|
||||||
commands.push(command.data.toJSON())
|
commands.push(command.data.toJSON())
|
||||||
}
|
}
|
||||||
|
|
||||||
;(async () => {
|
try {
|
||||||
try {
|
console.log(color(`Started refreshing ${commands.length} application (/) commands.`, "green"))
|
||||||
console.log(color(`Started refreshing ${commands.length} application (/) commands.`, "green"))
|
|
||||||
|
|
||||||
const commandsString = commands.map(command => " " + command.name)
|
const commandsString = commands.map(command => " " + command.name)
|
||||||
console.log(color(commandsString.join("\n"), "lavender"))
|
console.log(color(commandsString.join("\n"), "lavender"))
|
||||||
|
|
||||||
await rest.put(
|
await rest.put(
|
||||||
Routes.applicationCommands(env.dev.clientid),
|
Routes.applicationCommands(env.dev.clientid),
|
||||||
{ body: commands }
|
{ body: commands }
|
||||||
).then(() => {
|
).then(() => {
|
||||||
console.log(color(`Successfully reloaded ${commands.length} application (/) commands.`, "green"))
|
console.log(color(`Successfully reloaded ${commands.length} application (/) commands.`, "green"))
|
||||||
process.exit(0)
|
process.exit(0)
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
})()
|
|
||||||
|
|||||||
@@ -9,30 +9,28 @@ const commandFiles = fs.readdirSync("./src/commands/").filter(file => file.endsW
|
|||||||
const contentMenuCommands = fs.readdirSync("./src/commands-contextmenu/").filter(file => file.endsWith(".ts"))
|
const contentMenuCommands = fs.readdirSync("./src/commands-contextmenu/").filter(file => file.endsWith(".ts"))
|
||||||
|
|
||||||
for (const file of commandFiles) {
|
for (const file of commandFiles) {
|
||||||
const command: ICommand = require(`../src/commands/${file}`)
|
const { default: command } = await import(`../src/commands/${file}`) as { default: ICommand }
|
||||||
if (command.dev) {
|
if (command.dev) {
|
||||||
commands.push(command.data.toJSON())
|
commands.push(command.data.toJSON())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const file of contentMenuCommands) {
|
for (const file of contentMenuCommands) {
|
||||||
const command: ICommand = require(`../src/commands-contextmenu/${file}`)
|
const { default: command } = await import(`../src/commands-contextmenu/${file}`) as { default: ICommand }
|
||||||
if (command.dev) {
|
if (command.dev) {
|
||||||
commands.push(command.data.toJSON())
|
commands.push(command.data.toJSON())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
;(async () => {
|
try {
|
||||||
try {
|
console.log(`Started refreshing ${commands.length} application (/) commands.`)
|
||||||
console.log(`Started refreshing ${commands.length} application (/) commands.`)
|
|
||||||
|
|
||||||
await rest.put(
|
await rest.put(
|
||||||
Routes.applicationGuildCommands(env.dev.devid, env.dev.guildid),
|
Routes.applicationGuildCommands(env.dev.devid, env.dev.guildid),
|
||||||
{ body: commands }
|
{ body: commands }
|
||||||
).then(() => {
|
).then(() => {
|
||||||
console.log(`Successfully reloaded ${commands.length} application (/) commands.`)
|
console.log(`Successfully reloaded ${commands.length} application (/) commands.`)
|
||||||
process.exit(0)
|
process.exit(0)
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
})()
|
|
||||||
|
|||||||
Reference in New Issue
Block a user