Giter Club home page Giter Club logo

discord-rustserverstatus's Introduction

Discord bot that displayes online players

Docker Automated build Docker Pulls Docker Build Status Build Status

Discord-bot

Bot

Updates activity status on discord bot and displays how many players are connected to your game server that support gamedig / rest api sites and webrcon.

This was first created for the game Rust, but it also now support any games that support gamedig or from rest api from the sites below.

Written in nodejs and requires npm and nodejs version ^16.09.

You can run it on windows, macOS, linux or docker, se the installation for more info.

  • gamedig (All games)
  • Supported api sites:
  • rust-servers.info
  • rust-servers.net
  • battlemetrics.com (All games)
  • Bot update status every 1-3 minutes

Changelog

Changelog

Configuration

example_config.json

Location: config/serverX.json (default on first startup: config/server1.json)

{
  "debug" : false,
  "token"  : "your token here",
  "apiSite" : 4,
  "apiUrl" : "https://full uri here",
  "serverIp": "",
  "serverPort": "28015",
  "enableRcon" : "0",
  "rconhost"   : "",
  "rconport"   : "",
  "rconpass"   : "",
  "prefix" : "!",
  "roles"  :  ["Administrator", "admins"],
  "queueMessage"  :  "currently waiting in queue.",
  "statusType" : "",
  "updateInterval" : "1"
}

Installation:

  1. Download it as zip or use git clone https://github.com/kennethrisa/discord-rustserverstatus.git
  2. Extract it and open folder, than open powershell in the same folder.
  3. Run command: npm install (This downloads the require modules from package.json)
  4. a: You can manualy do this with command: npm install discord.js request ws gamedig
  5. b: You should now see that you have a new folder node_modules.
  6. c: Start the bot npm start, and then close it, you will then see it has created a config file under /config/server1.json
  7. Open config/server1.json and add your token from (Do not use client secret) https://discordapp.com/developers/applications/me/ Discord-bot-token
  8. Now we can start the bot with command: node app.js and you should see that the bot is started.

Install Windows only from command prompt (Manuall start)

  • Open powershell in the directory you downloaded: npm install
  • npm start # (It will fail bc of config file does not exist and create an example one)
  • It will now create a config file in folder config/server1.json
  • Edit server1.json with all the information.
  • Start the bot again: npm start

Windows only: Install the app as a windows service.

  • Open powershell: npm install
  • npm install -g node-windows
  • npm link node-windows
  • node installSVC.js
  • You will get some prompt to allow it to install, press yes on all.
  • Open services.msc and see discord-rustserverstatus is started. now it will always start on bootup.
  • Uninstall:
    • node uninstallSVC.js
    • Press yes on all prompts

Linux only: Start bot always using forever

  • $ npm install forever -g
  • $ forever start /path/to/app.js
  • Someone named nimdasys on oxide reported it. Thanks

Create your discord-bot and invite it to your server:

Docker

Using gamedig:
docker run --name discord-rustserverstatus --restart=unless-stopped \
   -e token="your token here" \
   -e apiSite=4 \
   -e serverIp=1.1.1.1 \
   -e serverPort=28015 \
   -e roles="Administrator" \
   kenrisa/discord-rustserverstatus:latest

docker run --name discord-rustserverstatus --restart=unless-stopped \
   -e token=your_token_here \
   -e apiSite=1 \
   -e apiUrl="https://full uri here" \
   -e enableRcon=1 \
   -e rconhost=yourip \
   -e rconport=28016 \
   -e rconpass="yourpassword" \
   -e prefix="!" \
   -e roles="Administrator" \
   -e queueMessage="currently waiting in queue" \
   -e statusType=""
   -e updateInterval="3" \
   kenrisa/discord-rustserverstatus:latest
  • Using docker-compose
git clone https://github.com/kennethrisa/discord-rustserverstatus.git
docker-compose pull
docker-compose up -d

Using with volumes and support for multiple bots:
Remove environment, and only have volumes:
---
version: '2'
services:
  bot:
    build: .
    image: kenrisa/discord-rustserverstatus
    container_name: discord-rustserverstatus
    restart: unless-stopped
    volumes:
      - ./config:/usr/src/app/config

  • You can also build the image your self using the docker-compose
git clone https://github.com/kennethrisa/discord-rustserverstatus.git
docker-compose build
docker-compose up -d

discord-rustserverstatus's People

Contributors

kennethrisa avatar austrixdev avatar wallopthecat avatar pridit avatar josh5k avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.