stanhope 411 Posted August 8, 2019 This bot has been discontinued and replaced with this one: https://forums.bohemia.net/forums/topic/231021-stans-server-monitor-bot/ Arma server monitor discord bot I recently made a discord bot that is able to monitor arma server to check if they go down. Additionally it also allows user to check the amount of players on server etc. There are other noteworthy features that are mentioned bellow. In this post I'm providing the source code for this bot so you can host your own bot doing this. Features Support for an unlimited amount of arma and teamspeak servers Pings given roles or users if one of those servers goes down The ability to turn those pings of for servers dynamically Logging for the number of players on those servers (can be turned on or off for every individual server) The ability to change how often the status of those servers should be checked The ability for users with certain roles to launch certain queries to those servers A 2 tier system for all bot commands (admin tier and normal users. Normal users can only run a limited amount of commands, admins can run every commend (see available commands) The ability to reread the config without having to restart the bot The ability to mute all down pings between 2 given hours (for scheduled restarts) The ability to upload missions to a server and change the default mission for a server The ability to launch and stop servers with this bot The bot is restricted to 1 channel A timeout between pings for the same server being down RSS reader support Uses discord embeds Available commands Spoiler Available commands: !servers list of all servers !serverStatus [server] prints whether a given server is up or down, if no server is given it'll print the status for all servers !playerCount [server] prints the number of players on a given server, if no server is given it'll print the player count for all servers !serverdetail [server]/!serverdetails [server] prints the server details of a given server, if no server is given it'll print the server details for all servers !players [server] prints the players connected to the current server. Requires a server !ping replies pong !info/!version prints version number of this bot as well as contact information for my maintainer !botstatus prints uptime of the bot and number of queries handled by the bot !commands/!help this Commands only available for admins: !rssAdd [link] adds an rss feed, specified by the link, in the channel the command is executed. !rssRemove [link] remove an rss feed, specified by the link. !rssList lists all the rss feeds in all the channels on server !changeNotifyStatus [on/off]/ !toggleNotify [on/off] toggles whether a notification will be send for the given server being down !reloadConfig reloads the config file !toggleLogging [server] toggles whether logs should be kept for a server !subscribeForDownPing/!unsubscribeForDownPing to subscribe/unsubscribe you from mentions when servers go down !saveconfig/!saveconf to save the config (it's strongly advised to run this after running ${prefix}subscribeForDownPing or ${prefix}unsubscribeForDownPing) !maintenance [server] [duration]/ !tempmute [server] [duration] to suspend down notifications for a given server for the given duration in minutes (10 minutes if no value is passed) !makeservervisible [server] to make a server visible for everyone !changedefaultmission [server] [missionName] to change the default mission of a server. Mission name must be the exact file name. !listmissions [server] to list all missions for a given server !uploadmission [server] [file] to upload a mission to a given server. File must be a PBO. !startserver [server]/!launchserver [server] to start a server (attention, no checks are done to ensure that the server isn't already started) !stopserver [server]/!killserver [server]to stop a server that was started using this bot !extendeddebug [on/off] to enable or disable extended debug information (in the console, not here) (if on or off isn't passed it'll select the other value !shutdownbot to gracefully shut down the bot. Consider saving the config before doing this. Usage This is simply source code, this is not a bot you can add to your server. You need to create your own bot and host this code. To create a bot I suggest googling 'how to create a discord bot', at the time of writing there are several very good tutorials available. To host the code; download the source from the link provided bellow, open the readme and read through it carefully, edit the config.json in the \config directory (there is a configExplenation.txt available in the same directory with some extra explanation on what each value is/does) and finally start the bot up using the commands provided in the readme. Requirements This bot requires node.js and a discord bot License This work is licensed under Apache License 2.0, full license included on the gitlab. Download - Bugs Please report bugs here or on the issue section of the above linked gitlab Planned features uploading missions via a link in addition to the traditional way Feel free to make suggestions though (but I make no promises about putting them in, all I promise is that I'll try) Updates Spoiler 22/03/20 -Added RSS reader with associated commands -Fixed some lacking documentation -Fixed change default mission not working correctly -Fixed issue with uploading missions 29/01/20 -Added the ability to upload missions to a server -Added the ability to launch and shutdown servers with the bot -Added a graceful shutdown command for the discord bot -Added the ability to hide certain servers from normal users (makes them only visible to admins) -Added the ability to prevent servers from being launched, their default missions being changed and missions being uploaded to it -Added a command to list all the missions on a server -Tweaked: extra checks to ensure roles and users to be mentioned when a server goes down actually exist -Updated the documentation -Various small updates and bug fixes 10/01/20 -Added changedefaultmission command, allows you to change the default mission of an arma server that's on the same machine as the bot -Added mentionWhenDownRoleIDs, allows you to ping roles instead of individual users -Fixed goodbotreplyDisabled not being saved upon saving config via the bot -Tweaked moved some code around, removed some duplicated code Possibly more things but I kinda lost track of what I did after not working on it for a month. 24/11/19 -Added saveconf command (does the same as saveconfig) -Added error messages are PMed to me now (one can disable this) -Fixed error messages showing on green embed instead of a red one -Fixed error messages formatting and date in the logfile 12/11/19 -Added tempmute command (to mute down notifications for a server for 10 minutes) -Tweaked footer timestamp (will now add a 0 to the front if the hours or minutes are bellow 10) 28/10/19 -Added bot status command (still needs documenting) -Added error logging -Fixed title of playercount saying "null" 26/8/19 -Added a players command -Added an option to specify where to save the logs -General code cleanup and improvements to make it a bit more sturdy 29/8/19 -Added discord embeds -Fixed several bugs -Fixed debug messages that snuck past me have been removed 08/9/19 -Added a line to the config example -Added a ping for when the server comes back up (can be configured for each individual server) -Fixed some bugs 09/9/19 -Added the typing prompt when the bot is doing a command for all servers -Fixed anyone being able to save the config -Tried fixing an error some server admins were getting 11/9/19 -Tweaked server back up ping (it now has 3 states, off/on/standard. Off to disable, On to always enable, standard to only enable when the previous down was not a scheduled one) -Tweaked message layout a bit -Updated documentation 14/9/19 -Added !info command, displays some information about the bot (todo, finish documenting this) -Fixed Alphabetically sorted player list is now actually alphabetically sorted -Tweaked Layout of some messages -Tweaked All messages that do not have their own footer now come with a UTC timestamp as footer -Code cleanup/optimization 14/9/19 Hotfix -Fixed servers not being recognized -Fixed !players command failing if there's too many people on server 3 Share this post Link to post Share on other sites
Eutyches 3 Posted August 24, 2019 Thank you! I look forward to exploring this. Share this post Link to post Share on other sites
Capwell 16 Posted August 25, 2019 This is awesome. Could you lis the commands able to use? Share this post Link to post Share on other sites
Capwell 16 Posted August 25, 2019 As a feature, could you add server is up notification? Share this post Link to post Share on other sites
stanhope 411 Posted August 25, 2019 3 hours ago, Capwell said: This is awesome. Could you lis the commands able to use? You mean the !help and !commands commands that are in there already or in my original post? 3 hours ago, Capwell said: As a feature, could you add server is up notification? Like a notification when it detects that the server is up? Or just the first time it detects it has gone up after it has gone down? Share this post Link to post Share on other sites
stanhope 411 Posted August 26, 2019 I've pushed an update, changelog is in the original post and new version is available at the download link that is also in the original post. 1 Share this post Link to post Share on other sites
Capwell 16 Posted September 5, 2019 On 8/25/2019 at 10:36 PM, stanhope said: Like a notification when it detects that the server is up? Or just the first time it detects it has gone up after it has gone down? First time it detects it has gone up after it has gone down Share this post Link to post Share on other sites
stanhope 411 Posted September 5, 2019 I'll add that when I get a chance, probably not this week 1 Share this post Link to post Share on other sites
stanhope 411 Posted September 8, 2019 Added the requested feature and fixed some bugs, full changelog and download link in the original post. Share this post Link to post Share on other sites
stanhope 411 Posted September 13, 2019 Released 2 more versions since my last reply here, full changelog and download link in the original post. Share this post Link to post Share on other sites
stanhope 411 Posted October 28, 2019 Released a new version with a fix and some new features. Full changelog and download link in the original post as per usual. Share this post Link to post Share on other sites
stanhope 411 Posted November 12, 2019 Released another version with a new commend (tempmute) and a small tweak. Full changelog and download link in the first post Share this post Link to post Share on other sites
stanhope 411 Posted November 24, 2019 Released another version, changelog and download link in the first post Important note for people who were already running this: new entries have been added to the config that should be added to your current config. Share this post Link to post Share on other sites
stanhope 411 Posted January 10, 2020 Released another version. Mainly to add the ability to mention roles in addition to users when a server goes down and the ability to change the default mission of your arma servers. Changelog and download link in the first post Share this post Link to post Share on other sites
HaniZHank 0 Posted January 23, 2020 Hello, I'm trying to get a bot that shows my server stat all the time, and I would like to have this on my discord, could you please make a tutorial or a youtube vid on how to implement this on a bot or something? Share this post Link to post Share on other sites
stanhope 411 Posted January 23, 2020 What do you mean by show my server starts all the time? Like a single message with the server details that's continuously updated? Share this post Link to post Share on other sites
stanhope 411 Posted January 29, 2020 Major update: Added the ability to upload mission files to the server and launch/stop server with this bot. Full changelog and download link in the first post. Share this post Link to post Share on other sites
stanhope 411 Posted March 22, 2020 Another updated: Fixed a few things and added an optional RSS reader Share this post Link to post Share on other sites
AshleyMosey 2 Posted April 2, 2020 Hi i cant seem to get this to start I get the following in commandline when I try nmp run start C:\Users\ashle\OneDrive\Documents\arma3servermonitordiscordbot-master>npm run start > awbot@1.0.0 start C:\Users\ashle\OneDrive\Documents\arma3servermonitordiscordbot-master > node ./src/index.js reading config... Something critical went wrong that caused the application to crash. SyntaxError: Unexpected string in JSON at position 288 at JSON.parse (<anonymous>) at Object.module.exports.readConfig (C:\Users\ashle\OneDrive\Documents\arma3servermonitordiscordbot-master\src\js\functions.js:15:27) at Object.<anonymous> (C:\Users\ashle\OneDrive\Documents\arma3servermonitordiscordbot-master\src\index.js:11:8) at Module._compile (internal/modules/cjs/loader.js:1147:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10) at Module.load (internal/modules/cjs/loader.js:996:32) at Function.Module._load (internal/modules/cjs/loader.js:896:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) at internal/main/run_main_module.js:17:47 EDIT** sorry figured it out it was because id made some errors in the config not putting , when I made new lines for the roll ids etc Share this post Link to post Share on other sites
stanhope 411 Posted April 2, 2020 There's something wrong in the config, presumably you edited something and made a syntax error somewhere. Google for json syntax validators and put your config through that. Share this post Link to post Share on other sites
AshleyMosey 2 Posted April 2, 2020 1 hour ago, stanhope said: There's something wrong in the config, presumably you edited something and made a syntax error somewhere. Google for json syntax validators and put your config through that. Yeah iv got it semi working now so the bot works and will start the server but it's not recognising it online and has started if I do !serverstatus I just get told it's down if I do *serverdetails it says its offline but it's not any recommendations? Share this post Link to post Share on other sites
stanhope 411 Posted April 2, 2020 Firewall issue? What kind of OS are you running it on? I know that both Ubuntu and Ubuntu server will display teamspeak servers as down because the firewall won't let it through. I don't have that issue on my windows 10 laptop. Share this post Link to post Share on other sites
AshleyMosey 2 Posted April 2, 2020 Its on Windows 10 im hosting both the server and discord bot from same PC too Share this post Link to post Share on other sites
stanhope 411 Posted April 2, 2020 That's strange, try adding a random server that you know the IP and port of and see if that works. If you got the latest version from master the first one in the config file should be up right now Share this post Link to post Share on other sites
AshleyMosey 2 Posted April 2, 2020 Yeah the one on the config works mine doesn't SEE SCREENSHOT HERE my config HERE Share this post Link to post Share on other sites