Flush System Documentation

The Flush System keeps your Discord server clean and synchronized with Albion Online. It automatically removes roles and database records from members and allies who have left their respective guilds, ensuring only active players retain their Discord permissions.

Prerequisites: Before using flush features, your bot must be configured via /setup start and the member role must be set. For the Ally Flush, the Alliance System must also be configured.

📖 Table of Contents

🔍 System Overview

The Flush System has two independent components that operate separately:

Member Flush

Checks primary and secondary guilds only. Runs automatically at the top of every hour (e.g., 01:00, 02:00 UTC). Can also be triggered manually via /flush command or the Dashboard.

Ally Flush

Checks allied guilds only. Runs automatically at every half hour (e.g., 01:30, 02:30 UTC). Can also be triggered manually via the Dashboard.

Important separation: The Member Flush never touches allies, and the Ally Flush never touches main guild members. They are completely independent processes.

⚙️ How the Flush Works

Both flush types follow the same general logic:

  1. Connect to the Albion Online API — The bot fetches the current member list from each configured guild.
  2. Compare with the database — The bot cross-references the API data with its local database of registered members/allies.
  3. Identify who left — Players no longer in any of their guilds are flagged for removal.
  4. Check Discord presence — The bot checks whether flagged users are still in the Discord server.
  5. Take action — Roles are removed and/or database records are deleted based on each user's situation.
  6. Log the result — A detailed embed is sent to the configured log channel.
Safety-first approach: If the Albion Online API returns an error, the flush is skipped entirely for that cycle. The bot never removes roles based on incomplete data — it's better to do nothing than to accidentally remove a legitimate member.

👥 Member Flush

What It Checks

The Member Flush checks all users registered as members against your configured primary and secondary guilds. Allied guilds are completely ignored in this process.

Who Gets Processed

The flush identifies three categories of users to process:

Category Situation Action Taken
🦵 Left Guild, Still in Discord Player left the Albion guild but is still in the Discord server All roles are removed (except Booster role). Record deleted from database.
👻 Left Guild & Left Discord Player left both the Albion guild and the Discord server Record deleted from database only (no Discord action needed).
🎭 Unregistered with Member Role User has the member role in Discord but is not registered with the bot Member role is removed (except Booster role). Any orphaned database records are cleaned up.
Booster role protection: If a user is a server booster, their booster role is always preserved even during a flush. All other roles are removed.

Automatic Schedule

The automatic member flush runs at minute 0 of every hour in UTC:

🤝 Ally Flush

What It Checks

The Ally Flush checks all users registered as allies against every configured allied guild. A player is only removed if they are absent from all allied guilds simultaneously. If they are in at least one allied guild, they are kept.

Who Gets Processed

The ally flush identifies four result categories:

Category Situation Action Taken
✅ Kept (Still Active) Player is still in at least one allied guild No action. Role and record are preserved.
🚪 Left All Allied Guilds Player is no longer in any allied guild but still in Discord Ally role is removed. Record deleted from database.
🚪 Left Discord Player left the Discord server (regardless of guild status) Record deleted from database only.
⚠️ Unauthorized (Role without record) User has the ally role but is not registered as an ally in the database Ally role is removed.

Optimized API Approach

The ally flush is designed to be efficient: it makes exactly one API request per allied guild, builds an in-memory map of all alliance members, and then checks every registered ally against that map. This avoids hundreds of individual API calls for large alliances.

Retry Logic

For each allied guild, the bot retries the API request up to 3 times with increasing delays (1s, 2s, 3s) before giving up. If any guild fetch fails after all retries, the entire ally flush is skipped to avoid false removals.

Automatic Schedule

The automatic ally flush runs at minute 30 of every hour in UTC:

💬 Discord Command: /flush

Purpose

The /flush command allows managers to manually trigger a Member Flush at any time, without waiting for the automatic hourly cycle. This is useful after mass guild changes or when roles seem out of sync.

Members only: The /flush command handles main guild members only. To manually flush allies, use the Dashboard's Ally Flush button.

Usage

/flush

No parameters required. The command automatically reads your configured guilds.

Required Permissions

The user must have the Management Role configured in your server settings. Regular members cannot use this command.

Step-by-Step Flow

Step 1 — Confirmation Preview

After running /flush, the bot queries the Albion Online API and displays a preview embed listing all users that will be affected, organized by category:

If everything is already in sync, the bot reports "No actions required" and shows no buttons.

Step 2 — Buttons

Two buttons appear on the confirmation embed:

Button Style Action
Confirm Red (Danger) Executes the flush immediately. Processes all listed members and shows a progress counter. After completion, sends a detailed result report.
Cancel Gray (Secondary) Cancels the operation without making any changes.
Timeout: The confirmation buttons expire after 10 minutes. If neither button is pressed within that time, the operation is automatically cancelled and no changes are made.

Step 3 — Progress Updates

While processing, the bot updates the message with a live counter every 10 members:

🔄 Processing members... 10/47 completed

Step 4 — Result Embeds

After completion, the bot sends up to 3 result embeds, one per category:

A log embed is also sent to your configured log channel with full details including who executed the command.

🖥️ Dashboard: Flush Configuration

The Flush Configuration page in the dashboard allows managers to control the automatic flush behaviour and trigger manual flushes for both members and allies.

Navigate to: Dashboard → Flush System (or equivalent menu entry for your server).

Status Overview Card

The top card shows the current status of both flush systems at a glance:

Member Flush Settings Card

This card has two controls:

Auto Toggle (Enable/Disable)

A toggle switch that enables or disables the automatic hourly member flush. This does not affect the manual flush button.

Execute Member Flush Now (Button)

Clicking this button triggers an immediate member flush, identical to what the automatic system does. A confirmation dialog appears before execution.

A modal window shows the flush execution progress in real time with a live log. After completion, a summary is shown and the modal's close button becomes available.

Ally Flush Settings Card

Same two controls as the member flush card, but for allies:

Auto Toggle (Enable/Disable)

Enables or disables the automatic hourly ally flush (runs at minute 30). Alliance configuration must be set up for this to have any effect.

Execute Ally Flush Now (Button)

Triggers an immediate ally flush with a real-time log modal. The close button is disabled while the flush is running and becomes available when it finishes.

📝 Log Channel Output

After every flush run (automatic or manual), a detailed embed is sent to your server's configured log channel. If no log channel is configured, logs are silently skipped.

Automatic Member Flush Log

Sent every hour after the member flush cycle completes. Contains:

Color coding: Green = all success, Orange = partial failures, Red = all failed.

If no changes are needed, a clean "✅ Automatic Hourly Member Flush — No Changes" embed is sent instead.

Automatic Ally Flush Log

Sent every half hour after the ally flush cycle completes. Contains:

If API errors occur during guild fetching, a separate "⚠️ Ally Flush Skipped — API Errors" embed is sent listing which guilds failed.

Manual /flush Command Log

After a manual /flush command is confirmed and executed, a log embed is sent containing:

🛡️ Safety Measures & API Errors

The flush system is built with a safety-first approach. It never removes roles when it cannot fully confirm someone has left.

When the flush is skipped

When the flush continues with a warning

Discord Command Error Messages

Error Cause What to do
Server Not Configured Bot setup has not been completed Run /setup start to configure the bot
Permission Denied User does not have the Management Role Ask an admin to assign the management role
No Guilds Configured No primary or secondary guild has been set up Run /setup start and configure at least one guild
🚫 API Service Unavailable Albion Online API is down or unreachable Wait a few minutes and try again. Check Albion Online server status.
⚠️ Albion Online API Error API returned timeout or server-side error (5xx) Temporary issue. Wait and retry.
⚠️ All Guild Synchronizations Failed All guilds failed to load from API Check Albion API status, network connectivity, and guild configuration.

🔒 Required Permissions

Discord Command (/flush)

Dashboard (Flush Configuration Page)

Bot Permissions Required in Discord

For the flush to successfully remove roles, the bot needs:

Role hierarchy is critical: If members have roles positioned above the bot's own role in the Discord role list, the bot cannot remove them. Make sure the bot's role is near the top of the role list in Server Settings → Roles.

🔧 Troubleshooting

Flush ran but some members still have their roles

Automatic flush is not running

Ally flush is not removing anyone who left

The /flush command shows "No actions required" but roles seem wrong

Log channel is not receiving flush logs