The Discord Janitor is a small bot that will remove messages older than a configured date from any channel it's added to.
Created for use with Shinobi, to automatically clear motion alert messages from discord after a certain amount of time.
-
Copy the provided
.env.dist
file to.env
-
Populate your bot key, and desired message expiration age, change to alternate run frequency as desired
-
Copy the provided
servers.json.dist
file toservers.json
-
Populate the servers.json with an object for each server, and an array of channels on each server to monitor
-
Install node packages, and run the script:
yarn install yarn start
Ultimately you probably want to run this on a remote server somewhere, and keep it alive with pm2 or similar.
Be aware that it may take a while to remove lots of old messages, or if your server is exceptionally busy this may not work at all as it currently exists.
!purge n: Purge the most recent n messages. In conjunction with the auto-removal of older messages, this command will allow manual removal of multiple recent messages.
Example: !purge 5
will remove up to 5 recent messages, and the purge command message itself.