SpeedtestTrackerBot is a Discord bot that interacts with the Speedtest Tracker, and it's API to provide various network performance metrics. This bot is designed to be run locally by the user.
- Health Check: Check if Speedtest Tracker is running.
- Latest Speedtest Results: Get the latest speedtest results.
- Node.js
- Discord Bot
- Discord Account ID
- A system running an instance of SpeedTest Tracker
- Speedtest Tracker URL and port
-
Clone the repository:
git clone https://github.com/josephistired/SpeedtestTrackerBot.git cd SpeedtestTrackerBot
-
Install the dependencies:
npm install
This bot was originally created to run on a Raspberry Pi that hosts my SpeedTracker instance, but it can also run on a Windows machine. Follow these steps to get the bot up and running on Windows.
-
Create a .env file in the root directory and add your Discord bot token, Discord account ID and Speedtest Tracker details:
DISCORD_TOKEN=your_discord_bot_token DISCORD_ID=your_discord_account_id SERVER_IP=your_server_ip SERVER_PORT=your_server_port
-
Simply run the bot.bat file located in the root directory!
Here's the cool setup! I have this bot running as a service on my Raspberry Pi. If you're a Raspberry Pi user, this should be a breeze (:
-
Copy the provided service file to the systemd directory:
sudo cp service/speedtesttrackerbot.service /etc/systemd/system/speedtesttrackerbot.service
-
Edit the file at /etc/systemd/system/speedtesttrackerbot.service.
- Line 10; replace /path/to/your/project with the actual path to your bot's main file.
- Line 13: replace /path/to/your/project with the actual path to your project directory.
- Lines 17, 18, 19, 20: Replace everything inside quotes with their respective values.
- Lines 23: Make sure to replace with the correct user.
-
Reload systemd to apply changes:
sudo systemctl daemon-reload
-
Enable and start the service:
sudo systemctl start speedtesttrackerbot sudo systemctl enable speedtesttrackerbot
-
The bot should now be running as long as you followed the steps correctly (:
You can run SpeedtestTrackerBot using Docker. Replace the placeholder values with your actual configuration.
-
Option 1 - Docker Command
docker run -d --name speedtesttrackerbot \ -e DISCORD_TOKEN=your_discord_bot_token \ -e DISCORD_ID=your_discord_account_id \ -e SERVER_IP=your_server_ip \ -e SERVER_PORT=your_server_port \ josephistired/speedtesttrackerbot:latest
-
Option 2 - docker-compose file.
version: '3.8' services: speedtesttrackerbot: image: josephistired/speedtesttrackerbot:latest container_name: speedtesttrackerbot environment: - DISCORD_TOKEN=your_discord_bot_token - DISCORD_ID=your_discord_account_id - SERVER_IP=your_server_ip - SERVER_PORT=your_server_port restart: always
Use the following commands in your Discord Server to interact with this bot:
- /healthcheck: Check if Speedtest Tracker is running.
- /latest: Get the latest speedtest results.
I plan on updating this bot with new features once the owner of SpeedTest Tracker adds more routes to the API. According to the project's Github, a rewrite is coming very soon (:
If you would like to contribute, please fork the repository and use a feature branch. Pull requests are welcome.