Skip to content

Message Logging

ryan edited this page Aug 6, 2017 · 5 revisions

Supporters only!

Message logging makes the bot store all messages it can see in a database. Message deletions and edits are tracked.

This is an opt-in feature, meaning it will only work after you enable it.

Enabling

To enable, type d?logging enable will enable logging in your server. Disable with d?logging disable.

Fetching messages

You can fetch a user's last n messages with the archive command:

d?archive user 50

That command will fetch user's last 50 messages and display them to you. You can refer to users by ID, mention, username, or username#discriminator.

Truncation

When messages are displayed, they are truncated to 1,500 characters. If a message is truncated, ... will be at the end.

Flags

You can vastly customize the output of d?archive by specifying flags. Flags are easy! To specify a flag, type -- then the name of the flag, like so:

d?archive user 50 --deleted

That command will only show deleted commands, for example.

Flags can also have values. You can add values to flags by typing --, the flag name, =, then the flag value, like so:

d?archive user 50 --mentions=336124860214542337

That command will only show messages by user that mention a user with an ID of 336124860214542337.

You can also chain flags. Multiple flags will be filter the output of d?archive just how you want it.

Flag list

  • --contains=heck Only accepts messages that contain heck somewhere inside.
  • --mentions=123 Only accepts messages that mention an ID of 123.
  • --channel=123 Only accepts messages that were sent in a channel with an ID of 123.
  • --edited Only accepts messages that were edited at some point.
  • --deleted Only accepts messages that were deleted at some point.
  • --hide-flags Hides the flags displayed before the date in d?archive output. This is not about command flags that you type. Before each line in d?archive output, there are characters that specify attributes about that message. A D flag means that message was deleted, a E flag means that message was edited. Both D and A means that the message was edited at some point, then deleted at some point.
  • --show-original Makes the bot show original messages. By default, if a logged message is edited, the new, edited message takes priority over the old message. By specifying this flag, the bot will always show the original message on edited messages.
  • --hide-dates Makes the bot hide timestamps in the output.
  • --show-ids Shows message IDs in the output.
  • --show-attachments Shows attachments as JSON-encoded data in the output.

Output flags

Before each line in the output could be D, E, or both. Don't get this confused with the command flags (the ones above!) These ones are different. Each letter means something about the message on that line.

  • D: The message was deleted.
  • E: The message was edited.

More examples

d?archive user 50 --show-ids --show-attachments

Shows user's last 50 messages, with message IDs and attachments.

Example output

E  17-07-27 19:31 ab

1 message that was edited at some point. It was posted on July 27, 2017. The message's contents is ab. By default, the bot shows the new contents, meaning if the message was edited (like above), the new contents show instead of the old content. To show old content instead, specify the --show-original flag.

Clone this wiki locally