From 7ae8d4330a68213eb13c8bfa02686c14ce5b0424 Mon Sep 17 00:00:00 2001 From: Wei Hong Date: Fri, 29 May 2026 23:01:47 +0800 Subject: [PATCH] Update README.md and some fixes. --- README.md | 12 ++++++++++++ helper.py | 11 +++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 417231f..46330f5 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,18 @@ doUpdate: true # set it to true to enable updater domains: [] # subdomains that you want auto-update (Example: { "name": "www.example.com", "proxied": true }) zone: null # zone of your domain name (such as example.com) ddnsBroadcastCode: code-here # IMPORTANT: Replace it that only you know +maintenancePageURL: "" # Maintenance page url (set it to an existing URL if you would use maintenance mode) +``` + +For dns item, use this template: + +``` +{ + "name": "www.example.com", # DNS name + "proxied": false, # Enable proxy (Enable this if you want to hide your server's real IP) + "type": "A", # or "CNAME", "AAA", "TEXT", "MX" + "allowMaintenance": true # Redirect to maintenancePage if maintenance mode is enabled. +} ``` Remember to restart the tool after you save the config file. \ No newline at end of file diff --git a/helper.py b/helper.py index cc70074..7b5d7ae 100644 --- a/helper.py +++ b/helper.py @@ -92,7 +92,7 @@ class CloudflareHelper(Helper): ) await message.channel.send(result) - @self.dc.handle_command("/cf:enable-maintenance", help="Enable maintenance mode") + @self.dc.handle_command("/cf:maintenance", help="Toggle maintenance mode") async def enable_maintenance(client, message): guild = getattr(message, "guild", None) if guild is None: @@ -100,7 +100,14 @@ class CloudflareHelper(Helper): return if self.is_allowed_broadcast_server(guild.name): - await message.channel.send(f"Updating DDNS...") + if not self.is_maintenance: + self.is_maintenance = True + self.update_ddns() + await message.channel.send(f"Maintenance mode is enabled. Updating DDNS...") + else: + self.is_maintenance = False + self.update_ddns() + await message.channel.send(f"Maintenance mode is disabled. Updating DDNS...") else: await message.channel.send(f"Unsupported server: {guild.name}")