Updated scripts to use esm syntax
Signed-off-by: Taken <taken@mairimashita.org>
This commit is contained in:
@@ -3,7 +3,6 @@ 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(
|
||||||
@@ -14,5 +13,3 @@ async function deleteCommands() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
deleteCommands()
|
|
||||||
|
|||||||
@@ -10,15 +10,14 @@ 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"))
|
||||||
|
|
||||||
@@ -35,4 +34,3 @@ for (const file of contentMenuCommands) {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
})()
|
|
||||||
|
|||||||
@@ -9,19 +9,18 @@ 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.`)
|
||||||
|
|
||||||
@@ -35,4 +34,3 @@ for (const file of contentMenuCommands) {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
})()
|
|
||||||
|
|||||||
Reference in New Issue
Block a user