ECO server discord status bot


  • Hey,

    I'm currently starting to create a small bot which allows requesting the servers status on discord. There is already a pre-release-version - feel free to test it. Every exception is collected and will be fixed later. But while I was testing everything seems to work fine already. :D

    Supported commands:
    requires the permission to edit the discord server settings:

    !addserver           - !addserver <name> <ip>:<webport>            - adds a server to the serverlist
    !delserver           - !delserver <name>                           - deletes a server from the serverlist
    !setformat           - !setformat {server_name}                    - variables / examples below
    !subscribemonitoring                                               - subscribe for status change-reports (online / offline)
    !unsubscribemonitoring                                             - stop reprting status changes (online / offline) 
    !setmonitoringformat - !setmonitoringformat offline {ip} offline   - defines the monitoring format
    !setname             - !setname somename                           - sets the discord clients name
    

    no permission check:

    !serverlist   - !serverlist                          - lists all servers added
    !status       - !status [name]                       - if no name provided the server named "main" will be used
    

    Formatting examples / variables for !status !serverlist and monitoring (if online):

        {server_tag}           => tag of the server
        {server_name}          => Server name
        {map_size}             => Map size
        {player_count}         => Current player count
        {max_players}          => Max players / player profiles available on the server
        {version}              => Eco version
        {animals}              => Animal count
        {plants}               => Plant count
        {provider}             => Hosting provider (company owning IP)
        {country}              => Country (location of IP)
        {address}              => IP + Port
        {ip}                   => IP
        {port}                 => Port
        {gametime}             => time since the server is running (ingame)
        {break}                => Line break
    

    Usage example:
    !setformat Server online! Servername: {server_name}{break}Players online: {player_count}

    Print everyting:
    !setformat server_name: {server_name}{break}map_size: {map_size}{break}player_count: {player_count}{break}max_players: {max_players}{break}version: {version}{break}animals: {animals}{break}plants: {plants}{break}provider: {provider}{break}country: {country}{break}address: {address}{break}gametime: {gametime}

    Formatting examples / variables for monitoring:

        {server_tag}          => tag of the server
        {ip}                  => IP of the server
        {port}                => Port of the server
    

    Examples:
    !setmonitoringformat online {server_tag} with the ip {ip} is unavailable!
    !setmonitoringformat online {server_tag} is up and running on version {version}! current gametime: {gametime}

    Todo:
    add further features

    • automatically announce when the server goes offline/online
    • custom status formatting
    • chat mirror (post ingame chat messages in discord)
    • ...
    • validation (especially for addserver command)
    • allow using domains while adding server
    • code cleanup

    You can use the following URL for adding this bot to your discord server:
    https://discordapp.com/oauth2/authorize?client_id=422848824525193216&permissions=2048&scope=bot

    Feel free to contact me on discord if you have any difficulties: msniveau#0719
    Feel free to contribute: https://github.com/msniveau/eco-status-bot


  • 26
    Posts
    3391
    Views
    Log in to reply


  • Okay, it took a while due to different things I was forced to do before starting working on the eco bot :D
    But now its implemented, just go to the channel you want to receive the messages to and type:
    !subscribemonitoring

    To unsubscribe just type !unsubscribemonitoring



  • @msniveau said:

    !subscribemonitoring

    Hi,
    thx that you did the code.
    One question: which is the interval the bot checks the server status?



  • Just another little thing :=) misspelling of "status"
    image.png



  • fixed the typo
    the check runs every 2 minutes



  • thx. Is there any way to donate your work?



  • not nessecary, the whole bot is currently only 300 lines long, so not complex enough :D
    just enjoy it, custom "offline" - "offline" message formats will follow

    But I've now reached the point that I need to refactor the whole thing to make this more pretty before implementing new stuff



  • in my oppion is still a code with e.g. 10 line donateable if its a good function someone needs :) But thx for your fast response and coding



  • so, cleaned up the codebase a little and added custom monitoring formatting, reduced by 100 lines of code :D

    New command: !setmonitoringformat <status> <format>
    valid status: online / offline
    example for offline monitoring messages:
    !setmonitoringformat offline [{server_tag}] {ip}:{port} is unavailable
    results in [main] 123.123.123.123:123 is unavailable



  • aaaand made it public - the code is still pretty ugly but okay :D
    github repo is linked in the main thread now


26
Posts
3391
Views
Log in to reply

Internal error.

Oops! Looks like something went wrong!