ScootKit / CustomDCBot

Create your own discord bot - Fully customizable and with a lot of features
https://scnx.xyz/bot
Other
41 stars 32 forks source link

Config can’t be created on Modules with a ready.js file #15

Closed jateute closed 3 years ago

jateute commented 3 years ago

I wanted to start the bot on my own computer and always when a module with a ready.js file is activated, the bot crashes, bevor the config file can be created, because the config file isn't there.

SCDerox commented 3 years ago

Could you please send the following information so I can help you:

Thanks 👍

jateute commented 3 years ago

I found the problem and created a new pull request.

SCDerox commented 3 years ago

The pull request would break the bot, so I had to close it ^^

SCDerox commented 3 years ago

I have pushed some changes regarding generating configuration-files, maybe that helps. Please try updating your bot and if that does not help, please provide me with the required information as described above.

jateute commented 3 years ago

Unfortunately, the update did not solve the problem. Here is the required information: console output:

[MODULE] Module admin-tools is disabled
[MODULE] Module auto-publisher is disabled
[MODULE] Module auto-react is disabled
[MODULE] Loading module betterstatus
[MODULE] Module birthday is disabled
[MODULE] Module giveaways is disabled
[MODULE] Module levels is disabled
[MODULE] Loading module moderation
[DB] Loaded model ./modules/moderation/models/ModerationAction.js
[COMMANDS] Loaded ./modules/moderation/commands/ban.js
[COMMANDS] Loaded ./modules/moderation/commands/clear.js
[COMMANDS] Loaded ./modules/moderation/commands/kick.js
[COMMANDS] Loaded ./modules/moderation/commands/mute.js
[COMMANDS] Loaded ./modules/moderation/commands/removeWarn.js
[COMMANDS] Loaded ./modules/moderation/commands/unban.js
[COMMANDS] Loaded ./modules/moderation/commands/unmute.js
[COMMANDS] Loaded ./modules/moderation/commands/userinfo.js
[COMMANDS] Loaded ./modules/moderation/commands/warn.js
[MODULE] Module partner-list is disabled
[MODULE] Module ping-on-vc-join is disabled
[MODULE] Module reaction-role is disabled
[MODULE] Module serverinfo is disabled
[MODULE] Module suggestions is disabled
[MODULE] Module welcomer is disabled
[COMMANDS] Loaded ./src/commands/help.js
[COMMANDS] Loaded ./src/commands/module.js
[EVENTS] Loaded ./modules/betterstatus/events/guildMemberAdd.js
[EVENTS] Loaded ./modules/betterstatus/events/ready.js
[EVENTS] Loaded ./modules/moderation/events/message.js
[EVENTS] Loaded ./src/events/message.js
[EVENTS] Loaded ./src/events/ready.js
[DB] Synced db
[BOT] Client logged in as TestBot155154184#1745 and is now online!
[INFO] Checking configs...
node:internal/modules/cjs/loader:923
  const err = new Error(message);
              ^

Error: Cannot find module 'E:\tests\customdcbot/config/betterstatus/config.json'
Require stack:
- E:\tests\customdcbot\modules\betterstatus\events\ready.js
- E:\tests\customdcbot\main.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:923:15)
    at Function.Module._load (node:internal/modules/cjs/loader:768:27)
    at Module.require (node:internal/modules/cjs/loader:995:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.module.exports.run (E:\tests\customdcbot\modules\betterstatus\events\ready.js:4:24)
    at Client.<anonymous> (E:\tests\customdcbot\main.js:161:69)
    at Client.emit (node:events:390:22)
    at WebSocketManager.triggerClientReady (E:\tests\customdcbot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:431:17)
    at WebSocketManager.checkShardsReady (E:\tests\customdcbot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:415:10)
    at WebSocketShard.<anonymous> (E:\tests\customdcbot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:197:14) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'E:\\tests\\customdcbot\\modules\\betterstatus\\events\\ready.js',
    'E:\\tests\\customdcbot\\main.js'
  ]
}

config.json:

{
  "token": "",
  "prefix": "!",
  "ownerID": "644566741795733537",
  "guildID": "791278225824415744",
  "user_presence": "Testbot"
}

modules.json:

{
  "admin-tools": false,
  "auto-publisher": false,
  "auto-react": false,
  "betterstatus": true,
  "birthday": false,
  "giveaways": false,
  "levels": false,
  "moderation": true,
  "partner-list": false,
  "ping-on-vc-join": false,
  "reaction-role": false,
  "serverinfo": false,
  "suggestions": false,
  "welcomer": false
}

Thanks for your help

SCDerox commented 3 years ago

I just pushed some changes where I replaced some events with a new botReady event which should fix this issue. Could you update your bot and try again (and report back)? ^^

jateute commented 3 years ago

I tried it with these fixes and now it works! Thanks 👍