Skip to content

Commit

Permalink
fix: استبدال دالة require بimport
Browse files Browse the repository at this point in the history
  • Loading branch information
Assayyaad committed Sep 3, 2024
1 parent 6b97ce3 commit 27566fc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/class/discordBot.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export class DiscordBot extends Client {
const i2 = files[i].length - '.json'.length
const name = files[i].substring(i1 + sep.length, i2)

const data = require(files[i])
const data = (await import(files[i])).default
if (data) {
if (name === 'config') Object.assign(this.data.config, data)
else this.data[name] = data
Expand Down Expand Up @@ -231,7 +231,7 @@ export class DiscordBot extends Client {
const failRecords = []

for (let i = 0; i < paths.length; i++) {
const botModule = require(paths[i])
const botModule = (await import(paths[i])).default

if (validCommand(botModule)) {
const record = this.registerCommand(botModule)
Expand Down

0 comments on commit 27566fc

Please sign in to comment.