This bot periodically checks Dragonite's database for accounts without a refresh token and sends a notification to a specific Discord channel.
- Discord bot configured and added to your discord server with creating messages permissions
- Node.js 18 or higher
- PM2 (Process Manager for Node.js applications)
-
Clone the repository:
git clone https://github.com/LucianoNeo/discord-sql-bot.git
-
Navigate to the project directory:
cd discord-sql-bot
-
Install dependencies:
npm install
-
Set up environment variables:
cp .env.example .env
- Modify the following environment variables to the .env file:
Replace your_mysql_host, your_mysql_user, your_mysql_password, your_mysql_database, your_mysql_port, your_discord_bot_token, and your_discord_channel_id with your actual MySQL database and Discord bot information. CHECK_INTERVAL is the interval in minutes for the bot to perform the database check.
DB_HOST=your_mysql_host DB_USER=your_mysql_user DB_PASSWORD=your_mysql_password DB_NAME=your_mysql_database DB_PORT=your_mysql_port DISCORD_TOKEN=your_discord_bot_token CHANNEL_ID=your_discord_channel_id CHECK_INTERVAL=15
You can start the bot using npm start:
npm start
This will execute the script specified in the start field of the package.json file, which is node account-checker.js.
After starting the bot with npm start, it will run in the foreground. To stop it, you'll need to terminate the process manually, for example, by pressing Ctrl + C in the terminal where the bot is running.
Alternatively, you can also start the bot with PM2, run:
pm2 start account-checker.js --name account-checker
To stop the bot, you can use:
pm2 stop account-checker
And to restart it, you can use:
pm2 restart account-checker
You can check the status of your bot using:
pm2 status
Additionally, you can monitor your bot's logs using:
pm2 logs account-checker
This project is licensed under the MIT License