Automated Discord bot to update Cloudflare DNS records when your IP changes and monitor website status.
Bot Discord tự động cập nhật DNS trên Cloudflare khi IP của bạn thay đổi và giám sát trạng thái website.
- Automatic public IP detection
- Automatic Cloudflare DNS updates when IP changes
- Discord notifications for IP updates
- Website status monitoring
- Multilingual support (English and Vietnamese)
- Interactive slash commands
- Node.js 16.x or higher
- Discord account
- Cloudflare account (with domain setup)
- Discord bot token
-
Clone repository:
git clone https://github.com/vovanhau123/cloud-ddns-bot.git cd cloud-ddns-bot -
Install dependencies:
npm install
-
Create environment file:
cp .env.example .env
-
Edit the
.envfile with your information
- Visit Discord Developer Portal
- Create a new application
- Go to the "Bot" tab and create a bot
- Save the token to
DISCORD_TOKENvariable in the.envfile - Go to "OAuth2" tab to set permissions and invite the bot to your server
- Select scopes:
botandapplications.commands - Select permissions:
Send Messages,Embed Links,Use Slash Commands
- Select scopes:
- Sign in to Cloudflare Dashboard
- Select the domain you want to update
- Get Zone ID from Overview tab (right side panel)
- Create API Token at Profile -> API Tokens
- Use "Edit zone DNS" template
- Set permissions: Zone - DNS - Edit
- Select zone resources for your domain
- Get Record ID from Cloudflare DNS Dashboard:
- Go to DNS tab
- Find the A record you want to update
- Click Edit and find "Record ID" in the URL or use DevTools Network tab when saving
Fill in all the following information in your .env file:
DISCORD_TOKEN= # Discord bot token
ZONE_ID= # Zone ID from Cloudflare
RECORD_ID= # Record ID of the A record to update
API_TOKEN= # API Token from Cloudflare
DOMAIN= # Domain or subdomain to update (e.g. example.com or home.example.com)
NOTIFICATION_CHANNEL_ID= # Channel ID for notifications
COMMAND_CHANNEL_ID= # Channel ID where commands are allowed
CLIENT_ID= # Application ID from Discord Developer Portal
GUILD_ID= # Discord server ID
CHECK_INTERVAL= # IP check interval (default: 300000ms = 5 minutes)
LOCALE= # Language (en or vn)
Run the bot:
npm startAvailable commands:
/ip- Show current IP (no DNS update)/checkip- Check and update IP immediately/checkweb [url]- Check website status/checkwebfull [url]- Check detailed website status/splash- Display bot information and available commands
The bot supports English and Vietnamese. To change the language, update the LOCALE variable in the .env file:
LOCALE=en # English
LOCALE=vn # Vietnamese
Vo Van Hau
MIT