flac / bhoptimer-bot

Discord bot for shavit's bhoptimer.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bhoptimer-bot

A discord.py bot for shavit's bhoptimer.

Support Server, PR's and issues are also welcome.

Includes:

  • Updating status message including playercount and current map (attempts to detect if server is offline).
  • Formatted list of online players, including hyperlinks to profiles.
  • RCON command execution, with console output.
  • Ability to check for a map within the mapcycle.
  • Ability to download (from GameBanana or Sojourner.me), extract, compress and send maps to FastDL (local or via FTP), including updating the mapcycle.

Setup

Works with Python 3.7+:

  • Clone this repository.
  • Install requirements with pip install -r requirements.txt.
  • Edit config.json.
  • Run using python bot.py / python3 bot.py.

config.json Fields Explained:

  • token - the Discord bot's token, found in the developer portal page for your application. If you are unsure on how to create a bot user, follow this guide.
  • prefix - the prefix used for bot commands.
  • server_ip - the bhop server's IP address.
  • server_port - the bhop server's port number.
  • rcon_password - the password used for RCON commands, if there isn't one for your server, add one to server.cfg, then edit this field.
  • mapcycle - the path to your server's mapcycle file, absolute path recommended, usually located in cfg/mapcycle.txt.
  • maps_folder - the path to your server's maps folder, absolute path recommended, usually located in cstrike/maps/.
  • ftp_ip - the IP address to your FTP server for FastDL, leave blank if FastDL is local.
  • ftp_user - the username to your FTP server for FastDL, leave blank if FastDL is local.
  • ftp_pass - the password to your FTP server for FastDL, leave blank if FastDL is local.
  • fastdl_folder - the path to your server's maps folder on FastDL, absolute path recommended.
  • admin_ids - a comma-separated array containing Discord ID's of users that will be allowed to execute RCON commands.
  • thumbnail - a link to an image that will serve as the 'thumbnail' for all embeds, can be left blank.
  • maps_channel - an ID of a Discord channel that will be used to send messages about newly added maps, can be left blank.

Commands + Images

players (aliases: online/playerlist)

  • Displays a list of online players, and bots.

image

  • Will also tell users if there is no one online.

image

rcon

  • Allows execution of RCON commands, has 3 types of output:
  • No response (no command supplied).

image

  • Embedded response (standard).

image

  • File response (over 2000 characters).

image

checkmap (aliases: mapcycle/mapcheck)

  • Tells the user if a specific map is in the current mapcycle.
  • Prefixless! Allows the user to enter a mapname without the bhop_, kz_ or kz_bhop_.

image

image

image

  • Error message on non-existent map.

image

downloadmap (aliases: dl/dm/dlmap/mapdl)

  • Allows the user to download maps onto the server, and uploads them to FastDL automatically.
  • Prefixless!
  • Supports Sojourner.me (CASE SENSITIVE).

image

  • And GameBanana.

image

  • If the maps_channel field is included, a message will display in a separate channel informing users of new added maps.

image

In the event of the server being offline, the RCON and players commands will display an embed.

  • Downloading maps may still work if the FTP is online, or the FastDL is local.

image

Known Issues

  • The bot will not go back online if offline, it must be restarted when the server is back online.
  • bzip2 compression stage is not async.
  • In !players, bots have the time played, as well as their respective replay time.

Credits

  • cherry - Showing me the initial idea of being able to remotely download maps to a server.
  • lorp - Few fixes + constructive criticism of code.
  • chris - Fix for the RCON embed.
  • Jeft - Fixes + general help with discord.py.
  • Evan - Open sourcing his bot which served as the base initially.
  • kangaroo hoppers - Continuous usage of the bot, allowing me to find errors and add additional features.
  • zammyhop - Initial users of the bot.

About

Discord bot for shavit's bhoptimer.


Languages

Language:Python 100.0%