This is the complete code for a Node.js Discord bot. This bot doesn't do the scanning itself, it just displays the scanned servers from my database, which is actively collected by a separate scanning program. You can access it yourself at https://api.cornbread2100.com/servers by sending a MongoDB find query in a POST request.
If you find any bugs, please report them in the official Discord server.
You can contact me via Discord: cornbread2100
Important
You can try the bot on its official Discord server without hosting it.
Put the bot's token and client id from the Discord Developer Portal into config.json, as well as a client id and secret from the Twitch Developer Console for streamsniping.
You'll need to install Node.js version v18 or later to run the bot. Then install all required dependencies with npm i
and run node deploy-commands
in your terminal to register the slash commands, otherwise they won't show up in Discord. Once everything is set up, run node index
to start the bot. Each command should load, and "[Bot]" will be logged when it's ready.
Warning
Don't forget to give the Discord bot the bot
and applications.commands
permissions in the URL generator.
Command | Description | Arguments |
---|---|---|
/help | Shows the bot's list of commands | None |
/stats | Sends some stats about the bot | None |
/random | Fetches a random online Minecraft server | None |
/ping | Fetches info from a given Minecraft Java server | ip (required), port (optional, defaults to 25565) |
/ping | Fetches info from a given Minecraft Bedrock server | ip (required), port (optional, defaults to 19132) |
/search | Searches the database for a server with specific properties | minimal (true/false), skip (integer), playercount (range), playerCap (integer), isfull (true/false), player (player name), playerhistory (player name) version (regex), hasimage (true/false), description (regex), hasplayerlist (true/false), seenafter (unix timestamp), iprange (ip subnet), port (integer), country (country name), org (organization name, uses regex), cracked (true/false), whitelist (true/false), vanilla (true/false) |
/streamsnipe | Searches the database for live Twitch streamers | language (language name) |