Skip to content

A small discord bot to interact with IW4M Admin's api and execute commands from discord

License

Notifications You must be signed in to change notification settings

Sparker-99/Admin-bot

Repository files navigation


bot


Discord server

Version 4.0.0


About

Admin bot is a discord bot written in Discord.js. It allows you to view relatime game servers info, execute server commands directly from discord, view stats and much more. Command handler and event handler is added so feel free to extend commands and events.


How it works


working


Download

Latest binary builds are always available at:


Setup

Admin bot requires less effort to get up and running.

Prerequisites

Installation

  • Windows

    • Install Node.js
    • Extract Admin-bot.zip
    • copy config/default_config.js, name it config.js and edit it
    • Edit config/config.js (add your token, prefix, webfronturl and adminid)
    • Run StartAdmin-bot.cmd or npm start in command prompt
  • Linux (Ubuntu 20:04)

    • Open Terminal and type:
    • sudo apt install nodejs npm
    • mkdir DiscordBot
    • cd DiscordBot
    • git clone https://github.com/Sparker-99/Admin-bot.git
    • cd Admin-bot
    • npm i
    • cp config/default_config.js config/config.js
    • nano config/config.js (add your token, prefix, webfronturl and adminid)
    • chmod +x ./StartAdminBot.sh
    • ./StartAdminBot.sh To host the discordBot on any other Linux distro You have to install nodejs and npm for your distro, then the rest is the same on all other Linux Distro.

Updating to new release version

Download latest build and Extract into old version directory, unless otherwise specified.

  • Existing database folder will be not overwritten by the update.
    • NOTE: any update of the default_config.js file will need to be merged manually by the user to the user's existing 'config.js file.
  • Any edit done on default commands files will be lost. Consider backup or rename the files before update.
  • Admin bot v3.0.5 or higher uses Node 16 which kills any application with critical exceptions. So its recommended to use PM2 or any program that restarts the bot.

Updating from 3.x.x to 4.x.x

Download latest build and Extract into new directory.

  • Existing database should be copied into new bot directory.
  • Copy default_config.js from config directory, and paste as config.js
  • Open old config.json and use it to fill out new config.js
    • NOTE: any update of the default_config.js file will need to be merged manually by the user to the user's existing 'config.js file.
  • Any edit done on default commands files will be lost. Consider backup or rename the files before update.
  • Admin bot v3.0.5 or higher uses Node 16 which kills any application with critical exceptions. So its recommended to use PM2 or any program that restarts the bot.

Configuration

Initial Configuration

Create a discord application from discord developers, click on add bot and copy the token if you dont know how read this Wiki

  • token — Insert the bot token
  • prefix — Insert the bot prefix that is used before commands like !help
  • webfronturl — Insert the IW4M Admin webfront url. In case of local refrain from using 127.0.0.1 or such use IPv4 or DHCP address.
  • results_perpage — Insert a number from 1 upto 10 to set number of results per page of status and players command

Optional Configuration

  • custom_presence — You can set bot's custom presence. Use this following parameters below
    • {m} — max players count
    • {p} — players online count
    • {s} — total server count
  • status_channel_id — You can insert a discord channel's id to send autostatus on an interval
  • statchan_update_interval — Specifies how often the bot will update the autostatus in channel in seconds
  • color — You can insert a hex colour code to get that colour for all embed discord messages
  • thumbnail_image_url — You can insert an image link to get custom thumbnail for all embed discord messages
  • footer — You can insert a footer message to display as footer for all embed discord messages
  • ownerid — You can insert an admin's or bot owner's client id to lock botinfo for administrator or bot owner

FAQ

  • Does Admin bot stores my ID and Password for Webfront ?

    • No, Admin bot retrieves cookies 🍪 from webfront which is saved and used for executing commands from Discord. Cookies are valid for 30 days or until host machine restart. You can successfully delete id and password in dm after login success message.
  • Why does the connect in serverinfo command not working ?

    • Not all clients support direct connect. Even it supports I dont know its launch url. If you know the launch url for direct connect for any client contact me on Discord
  • Why not use a proper Sqlite database instead of Json database ?

    • Sqlite Requires Node-Gyp which is a hassle for most windows users. So for Advanced Users Admin bot with Sqlite is available. There is no need for this tool in case of linux.

Contributers

Credits

*TFAGaming for creating DiscordJS-V14-Bot-Template

About

A small discord bot to interact with IW4M Admin's api and execute commands from discord

Topics

Resources

License

Stars

Watchers

Forks

Languages