/Minecraft-Server-Scanner-Discord-Bot

The public code for a Discord bot that searches through data collected from Minecraft server scanning (you can try it out here: https://discord.gg/Uy9m5TP5na).

Primary LanguageJavaScript

Minecraft Server Scanner Discord Bot

Discord Buy Me A Coffee Node.js
Minecraft Server Scanner Logo

Note

This product includes GeoLite2 data created by MaxMind.

📝 About

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

🌐 Hosting the bot yourself

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 Node.js version v18 or later to run the bot. Then install discord.js with npm i discord.js and run node deploy-commands.js in your terminal before to register the slash commands, otherwise they won't show up in Discord. Once everything is set up, run node index.js to start the bot. Each command will be loaded, 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.

💻 Usage

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 server ip (required), port (optional, defaults to 25565)
/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)
/streamsnipe Searches the database for live Twitch streamers language (language name)