{"id":19942348,"url":"https://github.com/bahlo/discord-retention-bot","last_synced_at":"2025-05-03T15:32:12.140Z","repository":{"id":37177894,"uuid":"317821087","full_name":"bahlo/discord-retention-bot","owner":"bahlo","description":"🤖 A bot that allows you to set a message retention for individual Discord text channels.","archived":false,"fork":false,"pushed_at":"2023-01-20T22:48:52.000Z","size":81,"stargazers_count":7,"open_issues_count":5,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-31T11:59:11.326Z","etag":null,"topics":["bot","channel","discord","messages","retention","rust","slack"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bahlo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-02T10:06:22.000Z","updated_at":"2023-03-05T07:29:02.000Z","dependencies_parsed_at":"2023-02-12T06:15:25.818Z","dependency_job_id":null,"html_url":"https://github.com/bahlo/discord-retention-bot","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahlo%2Fdiscord-retention-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahlo%2Fdiscord-retention-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahlo%2Fdiscord-retention-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahlo%2Fdiscord-retention-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bahlo","download_url":"https://codeload.github.com/bahlo/discord-retention-bot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224365408,"owners_count":17299156,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot","channel","discord","messages","retention","rust","slack"],"created_at":"2024-11-13T00:12:40.052Z","updated_at":"2024-11-13T00:12:40.724Z","avatar_url":"https://github.com/bahlo.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# discord-retention-bot [![CI](https://github.com/bahlo/discord-retention-bot/workflows/CI/badge.svg)](https://github.com/bahlo/discord-retention-bot/actions?query=workflow%3ACI) [![Audit](https://github.com/bahlo/discord-retention-bot/workflows/Audit/badge.svg)](https://github.com/bahlo/discord-retention-bot/actions?query=workflow%3AAudit)\n\nA bot that allows you to set a message retention for individual Discord text \nchannels.\n\n## Table of contents\n* [Features](#features)\n* [Preparation](#preparation)\n* [Installation](#installation)\n* [Configuration](#configuration)\n* [Troubleshooting](#troubleshooting)\n* [Integration tests](#integration-tests)\n\n## Features\n* Automatically delete messages that are older than a configured time\n* Don't delete pinned messages until configured otherwise\n* Multi channel configuration (e.g. keep messages `#general` for two weeks, but \n  `#random` for one day)\n* Default configuration for all channels without definend retention\n\n## Preparation\nBefore running your bot you need to create it on Discord:\n\n1. Create a Discord Application in the \n   [Discord Developer Portal](https://discord.com/developers/applications)\n2. Go to `Bot` and click `Add Bot` and make sure to uncheck `Public bot`\n3. Copy the `CLIENT ID` from the `General Information` tab\n4. Go to \u003chttps://discord.com/oauth2/authorize?client_id=$CLIENT_ID\u0026scope=bot\u0026permissions=74752\u003e\n   and add your bot to your Discord server\n\n### Wait, what does 74752 mean?\n74752 is the bitmask for the following permissions:\n\n* View Channels\n* Manage Messages\n* Read Message History\n\nYou can verify this by checking these in the Bot Permissions mask on your bots \npage.\n\n## Installation\n\n### Download binary\nGo to the [GitHub Releases](https://github.com/bahlo/discord-retention-bot/releases)\nand download the binary for your architecture.\n\n### Docker\nYou can use the provided Docker image at\n`docker.pkg.github.com/bahlo/discord-retention-bot/discord-retention-bot:1.0.2`.\n\n### Cargo\nRun `cargo install discord-retention-bot` to install the latest version from \n[crates.io](https://crates.io).\n\n### Build from source\n1. Clone the repository with \n   `git clone https://github.com/bahlo/discord-retention-bot`\n2. Run `cargo build --release` to build your binary to \n   `target/release/discord-retention-bot`\n\n## Configuration\n\nConfigure your bot via environment variables (optionally in an `.env` file).\n\n### `RUST_LOG` \nTihs defines the log level. I recommend setting this to \n`discord-retention-bot=info` for normal usage.\n\n### `DISCORD_TOKEN` \nThe token of your Discord bot. Get it from the \n[Discord Developer Portal](https://discord.com/developers) by going to your\napplication → Bot and copying the token.\n\n### `DELETE_PINNED` \nCan be set to `true` or `false`. If set to `true`, pinned messages \nwill also be deleted. Defaults to `false`.\n\n### `CHANNEL_RETENTION` \nA list of channel names and the duration after which messages should be deleted, \nseparated by a comma. You can also configure `*` to match all unconfigured \nchannnels.\nThe duration is a number followed by one of `h` (hours), `d` (days), and `w` \n(weeks).\nPlease note that this configuration applies to all guilds your bot is added to.\n\n#### Example\n`general:2w,random:4d,*:4w` will result in messages being deleted in\n* `general`: after two weeks\n* `random`: after four days\n* every other channel after four weeks\n\n## Troubleshooting\n### Why is it taking so long?\nDiscord might be rate-limiting you. This applications uses the single message\ndelete endpoint because [Bulk Delete Messages](https://discord.com/developers/docs/resources/channel#bulk-delete-messages) doesn't support messages older than 2 weeks. \nIt might take a while the first time, but it will get faster.\n\n### It's not deleting the messages of a channel\nMake sure the bot has access to that channel in the Discord application and the \nfollowing permissions:\n* Read Text Channels \u0026 See Voice Channels\n* Manage Messages\n* Read Message History\n\n## Integration tests\nTo run integration tests you need to create a bot (see \n[Preparation](#Preparation)), but with the bitmask 76816, which translates to:\n\n* Manage Channels\n* View Channels\n* Send Messages\n* Manage Messages\n* Read Message History\n\nExport the bot token to `INTEGRATION_DISCORD_TOKEN` and run `cargo test -- --ignored` to run the integration tests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbahlo%2Fdiscord-retention-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbahlo%2Fdiscord-retention-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbahlo%2Fdiscord-retention-bot/lists"}