Skip to content

vovanhau123/cloud-ddns-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IP Auto Updater Bot

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.

Features

  • 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

Requirements

  • Node.js 16.x or higher
  • Discord account
  • Cloudflare account (with domain setup)
  • Discord bot token

Installation

  1. Clone repository:

    git clone https://github.com/vovanhau123/cloud-ddns-bot.git
    cd cloud-ddns-bot
  2. Install dependencies:

    npm install
  3. Create environment file:

    cp .env.example .env
  4. Edit the .env file with your information

Configuration

Discord Bot Setup

  1. Visit Discord Developer Portal
  2. Create a new application
  3. Go to the "Bot" tab and create a bot
  4. Save the token to DISCORD_TOKEN variable in the .env file
  5. Go to "OAuth2" tab to set permissions and invite the bot to your server
    • Select scopes: bot and applications.commands
    • Select permissions: Send Messages, Embed Links, Use Slash Commands

Cloudflare Setup

  1. Sign in to Cloudflare Dashboard
  2. Select the domain you want to update
  3. Get Zone ID from Overview tab (right side panel)
  4. Create API Token at Profile -> API Tokens
    • Use "Edit zone DNS" template
    • Set permissions: Zone - DNS - Edit
    • Select zone resources for your domain
  5. 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

Edit .env file

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)

Usage

Run the bot:

npm start

Available 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

Language

The bot supports English and Vietnamese. To change the language, update the LOCALE variable in the .env file:

LOCALE=en    # English
LOCALE=vn    # Vietnamese

Author

Vo Van Hau

License

MIT

About

Discord bot tự động kiểm tra và cập nhật DNS records cho IP động trên Cloudflare. Giải pháp DDNS miễn phí cho các máy chủ sử dụng IP không cố định. | Automated Discord bot for monitoring and updating dynamic IP DNS records on Cloudflare. A free DDNS solution for servers with non-static IPs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors