dichternebel / csgo-rcon-bot

This discord bot can execute RCON commands on CS:GO/SRCDS servers.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CS:GO Server RCON Error

shaikhnedab opened this issue · comments

getting following error while using !csgo rcon commands
error

fyi I did used sudo chmod +x rcon-cli to make it executable.

I think you already got the right idea to think about permission settings. My best guess is that you either tried to run the app as root or used a file location without sufficient permission.
First: Don't use root to run anything. This is crucial!

In order to give you a brief instruction I just created a new Linux Ubuntu 18LTS instance to start from scratch and ssh-logged in with a sudo-enabled sshuser to ~/ ( home)

In order to test-run the app under the sshuser this is what I've done in detail (starting from home directory) on that fresh Ubuntu instance:

sudo apt-get update
curl -fsSL https://deb.nodesource.com/setup_15.x | sudo -E bash -
sudo apt-get install -y nodejs
git clone https://github.com/dichternebel/csgo-rcon-bot.git --depth=1
cd csgo-rcon-bot
npm i
mkdir bin && cd bin
wget https://github.com/itzg/rcon-cli/releases/download/1.4.8/rcon-cli_1.4.8_linux_amd64.tar.gz
tar xf rcon-cli_1.4.8_linux_amd64.tar.gz
cd ..
nano .env
BOT_TOKEN="YouVerySecretDevBotTokenGoesHere"
RCON_CLI_PATH="~/csgo-rcon-bot/bin/rcon-cli"
node index.js

Doing so will let the app run in the home directory using rcon-cli in the bin directory of the app. There were no need to chmod anything and it works as expected on my site. Please get back to me if you were able to follow and I will update the ReadMe of the project in order to give more detailed information on how to set this up.

I have followed your guide step by step by creating new sudo user and getting following error.
error

This is my .env file.

NODE_ENV="development"
BOT_TOKEN="token"
IMG_BASEURL="https://proud-dune-027bff803.azurestaticapps.net/"
RCON_CLI_PATH="~/csgo-rcon-bot/bin/rcon-cli"

if you want I can give you access to my VPS as it is just a test VPS for this bot only.

Oops! You found a bug. ;-) Just fixed that. Please pull the latest version.

well that worked. thanks for the quick fix.
also do add above installation guide into readme including creating separate user for the bot.

another issue.

DiscordAPIError: Invalid Form Body
embed.description: Must be 2048 or fewer in length.
    at RequestHandler.execute (/home/ds/csgo-rcon-bot/node_modules/discord.js/src/rest/RequestHandler.js:154:13)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at async RequestHandler.push (/home/ds/csgo-rcon-bot/node_modules/discord.js/src/rest/RequestHandler.js:39:14) {
  method: 'post',
  path: '/channels/7XXXXXXXXXXXXXXXX/messages',
  code: 50035,
  httpStatus: 400
}

use payload so bot doesn't gets stuck on sending messages with more than 2048 characters.

This is a limitation by discord that you should handle by using config files on the server to be executed instead of sending huge payloads.
If you really need to spam your text channel you could try this approach:
https://stackoverflow.com/questions/55818959/richembed-descriptions-may-not-exceed-2048-characters

Also please do not reuse fixed issues by hi-jacking them with new off-topic issues. Closing this for now.