Skip to content

Discord Setup

DynaDev edited this page Aug 12, 2026 · 1 revision

Discord Setup

TownyAlerts uses DiscordSRV for Discord connectivity.

It does not require:

  • A second Discord bot
  • A Discord bot token in TownyAlerts
  • A webhook URL
  • A direct Discord HTTP client

How messages are sent

The flow is:

Towny event
   |
   v
TownyAlerts
   |
   v
DiscordSRV / JDA
   |
   v
Discord channel

TownyAlerts reuses the authenticated Discord connection already managed by DiscordSRV.

Configure the default channel

Set the channel ID in:

plugins/TownyAlerts/config.yml

Example:

discord:
  channel-id: "123456789012345678"

Use a Discord channel ID, not a channel name.

Per-event channels

You may route different alert categories to different channels:

discord:
  channel-id: "123456789012345678"

  channels:
    new-day: "234567890123456789"
    bankruptcy: "345678901234567890"
    ruin: "456789012345678901"

If an event-specific value is empty, the default channel is used.

Example:

discord:
  channels:
    bankruptcy: ""

Bankruptcy alerts will inherit discord.channel-id.

Test the channel

Run:

/townyalerts test

This sends a TownyAlerts test message only.

It does not:

  • Run a Towny New Day
  • Charge taxes
  • Change balances
  • Modify towns or nations

Status

Run:

/townyalerts status

The status output includes the integration state without exposing secrets.

DiscordSRV initialization

DiscordSRV may still be initializing JDA when TownyAlerts starts.

TownyAlerts handles this with bounded retries when configured:

retry:
  enabled: true
  max-attempts: 3
  delay-seconds: 5

Discord failures are contained and do not interfere with Towny processing.

Clone this wiki locally