Skip to content

EventMessages

Domekologe edited this page Jun 30, 2026 · 1 revision

EventMessages

🌐 English · Deutsch

EventMessages posts automatic, public announcements when something happens on your server — a member joins or leaves, gets kicked, banned, unbanned, timed out, or has a timeout expire. Each of the seven events has its own on/off switch, target channel and message template, all configurable per guild via slash commands or the PDC Web Dashboard. Every event is disabled by default, so nothing is posted until you turn it on. Author: pd-codes · requires Red 3.5.0+ and Python 3.10+.

Screenshot: EventMessages join notification in Discord

Installation

[p]repo add PDC_Redbot_Cogs https://github.com/pd-codes/PDC_Redbot_Cogs
[p]cog install PDC_Redbot_Cogs EventMessages
[p]load EventMessages
[p]slash sync

[p] is your bot's prefix. See Installation for the full Downloader walkthrough. All configuration commands are slash commands, so run [p]slash sync once after loading.

Events

Event Trigger Notes
join Member joins
leave Member leaves Fired on member removal when it was not a kick.
kick Member kicked Detected via the audit log on member removal — the cog checks the last 5 kick entries to match the leaving member.
ban Member banned Moderator and reason read from the audit log.
unban Member unbanned Moderator read from the audit log.
timeout Timeout applied Moderator, reason and end time ({duration}) read from the audit log.
timeout_end Timeout expires/removed Fired when timed_out_until clears.

Because kick and leave both stem from the same member-removal event, the cog relies on Discord's audit log to tell them apart. Audit-log entries can be slightly delayed; the bot needs View Audit Log permission for kick/ban/unban/timeout attribution to work.

Commands

All three commands are slash-only application commands. The event argument has autocomplete over the seven event names.

Command Parameters What it does
em-enabled event, value (true/false) Enables or disables messages for one event.
em-channel event, channel Sets the text channel a given event posts to.
em-status Shows an ephemeral overview of every event: enabled state and target channel.

A message for an event is only sent when that event is enabled and has a channel assigned. All command replies are ephemeral.

Configuration — per-event settings & templates

EventMessages stores its config per guild (Red Config, identifier 981273598123). Each of the seven events has an enabled flag and a channel ID; a parallel templates mapping holds the message text per event.

Template variables

Variable Meaning Populated for
{display_name} Member's display name all events
{username} Full username (name#tag form) all events
{moderator} Acting moderator (mention) kick, ban, unban, timeout
{reason} Reason from the audit log kick, ban, timeout
{duration} Timeout end time (relative timestamp) timeout

Variables that don't apply to an event fall back to safe defaults (e.g. {reason} → "Kein Grund angegeben", {moderator} → "Unbekannt"). An invalid template is posted verbatim rather than raising an error.

Default templates (German)

Event Default template
join 🎉 **{display_name}** ist dem Server beigetreten!
leave 👋 **{display_name}** ({username}) hat den Server verlassen.
kick 👢 **{display_name}** ({username}) wurde gekickt. Moderator: {moderator} | Grund: {reason}
ban ⛔ **{display_name}** ({username}) wurde gebannt. Moderator: {moderator} | Grund: {reason}
unban 🔓 **{display_name}** ({username}) wurde entbannt. Moderator: {moderator}
timeout ⛔ **{display_name}** ({username}) erhielt Timeout. Moderator: {moderator} | Grund: {reason} | Bis: {duration}
timeout_end ⏱️ Timeout für **{display_name}** ({username}) ist abgelaufen.

Dashboard integration

EventMessages registers with the PDC Web Dashboard automatically on load (and re-attaches if the dashboard cog appears later). Three surfaces are exposed:

Surface Mount Permission Purpose
Widget "Aktive Events" Dashboard home (KPI, small) guild_member Counts how many events are currently enabled.
Panel "Event-Nachrichten" guild_settings guild_admin Per event: enable switch, channel dropdown and message textarea with variable hints.
Standalone page eventmessages own page (GET/POST) manage_guild / bot owner Full-page editor for every event's enabled flag, channel ID and template.

Screenshot: EventMessages dashboard panel

Permissions & notes

The configuration commands require server-management rights as usual for Red; the dashboard surfaces require guild_admin / manage_guild (or bot owner). For the bot to attribute moderators and reasons correctly it needs View Audit Log, and Send Messages in each configured channel. The cog persists only guild settings — enabled flags, channel IDs and templates — and no personal data.

See also: Installation · Dashboard Integration · AdminUtils · Home

Clone this wiki locally