Server Log - CosmicCubicle/PariahBot GitHub Wiki

Server Log

A record of what happens in your server, posted to channels you choose. It's split into four sections. Each one has its own on/off switch and its own channel, so you can send moderation to a staff channel and message edits somewhere else, or put everything in one place.

Section What it logs
Kicks and bans Members kicked, banned and unbanned, by anyone: a moderator in Discord, another bot, or PariahBot. Ones PariahBot carried out name their /mod case
Joins and leaves Members joining (with how old their account is) and leaving (with when they joined and the roles they had)
Messages Messages edited and deleted, with a link. The text too, if the bot's host has switched it on (below)
Server changes Roles and channels created, edited or deleted, channel permission changes, and members gaining or losing roles, with who did it

It needs admin (Discord's Administrator permission, or an admin role).


Before you start

The bot's host and the server each need one thing.

The host: switch on Server Members Intent. Every PariahBot installation needs this, whether or not a server uses the log. In the Developer Portal, open your application → Bot → Privileged Gateway Intents, switch on Server Members Intent, and Save Changes. Without it, the bot can't connect. See Bot-Setup.

The server: give the bot View Audit Log. Kicks and bans and Server changes come from the server's audit log, which needs View Audit Log on the bot's PariahBot role (Server Settings → Roles). The standard invite includes it. Without it, those two sections log nothing, and /logging status and the dashboard say so.

In each log channel, the bot needs View Channel, Send Messages and Embed Links. Make the channels private to your staff: the log shows who did what, and possibly what members wrote.


Set it up

With commands

/logging set section:Kicks and bans channel:#mod-log
/logging set section:Joins and leaves channel:#join-log
/logging set section:Messages channel:#message-log
/logging set section:Server changes channel:#mod-log

Picking a channel switches the section on. Sections can share a channel.

Command What it does
/logging set section: channel: Choose where a section posts, and switch it on
/logging disable section: Switch a section off. Its channel is kept
/logging enable section: Switch it back on, in the channel it had
/logging status Every section, its channel, and anything stopping it

On the dashboard

The Admin-Dashboard has a Logging tab with a card for each section: pick a channel, then switch it on or off. A card shows any problem, such as a missing permission or a deleted channel, with what to do about it.


What each section shows

Kicks and bans

Who was kicked, banned or unbanned, who did it, and the reason from the audit log.

When PariahBot did it, through /mod, a right-click action, the honeypot, or a temporary ban ending, the entry also names its case, e.g. #12, through the bot by @Moderator. Use it to find the same action in /mod history and in the Admin-Alerts, which report it too.

A softban is a ban followed straight away by an unban, so it shows as both.

Joins and leaves

  • Joined: the member, when their account was created (a brand-new account is often worth a look), and the new member count.
  • Left: the member, when they joined, and the roles they had.

A member who was kicked or banned also shows here as having left. Kicks and bans says why.

If someone joined before the bot last restarted, their leave may say Unknown for when they joined and their roles. The bot only knows members it has seen since it started.

Messages

  • Edited: who, in which channel, and a link to the message.
  • Deleted: who and in which channel, when it was sent, and any attachment names.
  • Deleted in bulk (a purge, or a ban that removed someone's recent messages): how many, and where.

Left out on purpose: messages from bots, and anything in a channel with Auto-Delete, whose messages are deleted on purpose.

Who deleted a message isn't shown. Discord only records that in the audit log for messages deleted by someone else, and only in batches.

The text of the message is shown only if the bot's host has switched it on (below). Without it, an edit says who and where, and the link shows the new version.

Server changes

Roles and channels created, edited or deleted, permission changes on a channel, and roles added to or removed from a member, each with who did it and what changed. For example, Name: general → chat, or Allowed: + Send Messages.

Changes PariahBot makes itself aren't logged here. Without that, every Temp-Voice-Channels would be two entries and every Role-Menus pick another. Changes made through the bot's commands are in its command audit log instead (see Admin-Alerts).


Message text (for the bot's host)

Logging what an edited or deleted message said needs Discord's privileged Message Content intent. It's off unless the host turns it on, and then it's on for every server the bot is in that logs messages.

  1. In the Developer Portal: your application → Bot → Privileged Gateway Intents, switch on Message Content Intent, and Save Changes.

  2. Rerun the setup script (sudo ./deploy/setup.sh or sudo ./deploy/container-setup.sh), press Enter to keep each setting, and answer yes to Log the text of edited and deleted messages? It sets the option and restarts the bot.

    Or by hand: set this in hom.env,

    SERVER_LOG_MESSAGE_CONTENT=true
    

    then restart the bot: sudo systemctl restart pariahbot.service, or for the container install, sudo docker compose up -d in /opt/pariahbot-container.

The owner's Status page on the Admin-Dashboard shows whether it's on.

Do step 1 first: with the setting on and the switch off, Discord refuses the login.

Edits then show Before and After, and deletions show the Text, cut to fit Discord's limit of 1,024 characters per field.

How it works: by the time Discord says a message was edited or deleted, the old text is gone. So the bot keeps recent messages in memory, for up to a day, and only for servers whose Messages section is on. Nothing is written to disk. For anything older, or after a restart, the entry says the text isn't known.

Think about it before switching it on. The bot copies members' messages into a staff channel, including ones they deleted. That's often the point, but your members may not expect it, and some servers say so in their rules.


Switching it off

  • One section: /logging disable, or Switch off on its card.
  • The whole log, for one server: /setup feature disable feature:logging. Each section's settings are kept. See Feature-Switches.

Troubleshooting

Nothing is posted. Run /logging status. It shows each section's state, its channel, and anything stopping it. The usual causes:

  • The section is off, or has no channel.
  • The bot can't post in the channel (needs View Channel, Send Messages, Embed Links).
  • Kicks and bans or Server changes: the bot lacks View Audit Log.
  • The whole feature is switched off: /setup feature list.

The bot won't come online after updating. Its host hasn't switched on Server Members Intent (see Before you start). The bot's log says Discord refused to connect. See Troubleshooting.

Edits and deletions don't show the text. Message text is off on this bot (see above), or the message is older than a day or from before the bot last restarted.