Abhijith4124 / Ahhh-Bot

Ahhh Bot - Palworld Discord Bot | Whitelist | Join/Leave Messages | Automatic Roles and Announcement
15 stars 3 forks source link

Bot offline #23

Closed ShadyGame closed 8 months ago

ShadyGame commented 8 months ago

The bot is showing as offline on my discord server, i tried to add it again. still doesnt work.

Any ideas?

When i run pm2 start index.js, i get the messaged errored when i type pm2 list, and its not using any memory so its not working, cant figure out why

Abhijith4124 commented 8 months ago

Can you post the error message here? Screenshot or something?

ShadyGame commented 8 months ago

Its back!

!"Was Sleeping for a while! Back Online now!"

thats what it says xD

Screenshot 2024-03-0pl1 190759

Error: Cannot find module 'node:fs'
Require stack:
- /root/palbot/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Module.Hook._require.Module.require (/usr/local/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:81:25)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/root/palbot/index.js:1:12)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Object.<anonymous> (/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js:33:23)
    at Module._compile (internal/modules/cjs/loader.js:999:30) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/root/palbot/index.js' ]
}

Error: Cannot find module 'simple-json-db'
Require stack:
- /root/palbot/index.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1149:15)
    at Hook._require.Module.require (/usr/local/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:81:25)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/root/palbot/index.js:2:16)
    at Module._compile (node:internal/modules/cjs/loader:1378:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1437:10)
    at Module.load (node:internal/modules/cjs/loader:1212:32)
    at Module._load (node:internal/modules/cjs/loader:1028:12)
    at Object.<anonymous> (/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js:33:23)
    at Module._compile (node:internal/modules/cjs/loader:1378:14) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/root/palbot/index.js' ]

running with node index.js

 node index.js
/root/palbot/utils/discord/commandsDeploymentManager.js:5
const rest = new REST().setToken(config.token);
             ^

TypeError: REST is not a constructor
    at Object.<anonymous> (/root/palbot/utils/discord/commandsDeploymentManager.js:5:14)
    at Module._compile (node:internal/modules/cjs/loader:1198:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
    at Module.load (node:internal/modules/cjs/loader:1076:32)
    at Function.Module._load (node:internal/modules/cjs/loader:911:12)
    at Module.require (node:internal/modules/cjs/loader:1100:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object.<anonymous> (/root/palbot/index.js:12:58)
    at Module._compile (node:internal/modules/cjs/loader:1198:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)

What version of node should i use?

So even if i dont have the bot running i still get the join/left messages?

Abhijith4124 commented 8 months ago

@ShadyGame NodeJS Version 20.11.1 is recommended. Did you run npm install before running the bot?

So even if i dont have the bot running i still get the join/left messages?

Nope, you would not get any join/left messages.

ShadyGame commented 8 months ago

strange, i have the bot offline and still get the messages.

okay i updated nodejs, now i have a different error:

TypeError: REST is not a constructor at Object.<anonymous> (/root/palbot/utils/discord/commandsDeploymentManager.js:5:14) at Module._compile (node:internal/modules/cjs/loader:1103:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Module.require (node:internal/modules/cjs/loader:1005:19) at Module.Hook._require.Module.require (/usr/local/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:101:39) at require (node:internal/modules/cjs/helpers:102:18) at Object.<anonymous> (/root/palbot/index.js:12:58) at Module._compile (node:internal/modules/cjs/loader:1103:14)

Abhijith4124 commented 8 months ago

@ShadyGame could you try running the docker version then if you cant get the node js working directly. I've made the docker image so that it works out of the box for everyone.

ShadyGame commented 8 months ago

@ShadyGame could you try running the docker version then if you cant get the node js working directly. I've made the docker image so that it works out of the box for everyone.

okay ill try, what's ?

Abhijith4124 commented 8 months ago

replace <host_data_directory> with a directory of your host machine, example /home/user/ahhbot for linux and C:/my_data for windows

You can google about Docker directory mount. The above said folders are just examples.

ShadyGame commented 8 months ago

Docker directory mount

you have one mistake in your script, i couldnt find the image with abhijith4124/ahhhbot:latest i had to use abhi4124/ahhhbot:latest

Atleast thats what worked for me, its running fine now :D

How can i edit the files using docker? i want to translate some lines.

Abhijith4124 commented 8 months ago

Oh ya mb! will change that in the docs. If you want to edit the files, i would recommend either cloning or forking the repo and then making the changes. You can create an docker image for yourself using the Dockerfile Provided.