A Discord bot that automatically keeps channels clean by converting message replies into organized public threads. Thread It promotes organized conversations by seamlessly moving reply discussions into dedicated threads, preventing channel clutter while maintaining context.
π¦ Video Demo
Thread.It.mp4
- Features
- How It Works
- Installation
- Usage
- Required Permissions
- Support & Documentation
- Contributing
- License
- Automatic Thread Creation: Converts message replies into organized public threads
- Clean Channel Management: Keeps main channels clutter-free by moving discussions to threads
- Smart Thread Naming: Automatically generates meaningful thread names from original message content
- Seamless Operation: Works in the background without requiring manual commands
- Content Preservation: Maintains all reply content including text, attachments, and embeds
- Permission Validation: Ensures proper bot permissions before attempting operations
- Comprehensive Logging: Detailed logging for monitoring and debugging
- Error Handling: Robust error handling with graceful fallbacks
- User posts a message in a Discord channel
- Another user replies to that message
- Thread It detects the reply and automatically:
- Creates a public thread on the original message
- Moves the reply content into the new thread
- Removes the original reply from the main channel
- Preserves all attachments, embeds, and formatting
The result: Clean main channels with organized discussions in dedicated threads!
- Python 3.9 or higher
- A Discord bot token
- Discord server with appropriate permissions
git clone https://github.com/wei/thread-it.git
cd thread-it
# Create virtual environment
python -m venv venv
# Activate virtual environment
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate
pip install -r requirements.txt
- Go to the Discord Developer Portal
- Create a new application
- Navigate to the "Bot" section
- Create a bot and copy the token
- Enable the following Privileged Gateway Intents:
- Message Content Intent (required)
- Generate an invite URL with these permissions:
- View Channels
- Send Messages
- Send Messages in Threads
- Create Public Threads
- Manage Messages
- Read Message History
# Copy the example environment file
cp .env.example .env
# Edit .env with your bot token
# DISCORD_TOKEN=your_bot_token_here
# LOG_LEVEL=INFO
python bot.py
Once installed and running, Thread It works automatically! No commands are needed.
Main Channel:
π€ Alice: "What's everyone's favorite Python library?"
π€ Bob: "I love requests for HTTP calls!" (replies to Alice's message)
Result: Thread It automatically creates a thread titled "What's everyone's favorite Python library?" and moves Bob's reply into it.
- β Text messages
- β Images and attachments
- β Embeds
- β Message formatting (bold, italic, code blocks, etc.)
- β Mentions and links (cleaned from thread names)
- Ignores bot messages: Prevents infinite loops
- Only processes replies: Regular messages are left untouched
- Skips existing threads: Won't create threads within threads
- Validates permissions: Checks required permissions before acting
- Sends helpful notifications: Briefly notifies users where to continue their conversation (auto-deletes after 8 seconds)
- Handles errors gracefully: Logs issues without crashing
Thread It requires specific Discord permissions to function properly. When inviting the bot to your server, ensure these permissions are granted:
Permission | Purpose |
---|---|
View Channels | Read messages in channels |
Send Messages | Send messages in main channels |
Send Messages in Threads | Send messages in created threads |
Create Public Threads | Create threads on messages |
Manage Messages | Delete original reply messages |
Read Message History | Access message history for context |
The following intents must be enabled in the Discord Developer Portal:
- Message Content Intent (Privileged): Required to read message content
If you're experiencing permission-related problems, see our Troubleshooting Guide for detailed solutions.
- π Issues: Report bugs or request features
- π§ Troubleshooting: Common issues and solutions
- π Design Docs: Technical specification
- π Discord.py: Official discord.py documentation
- Having problems? β Check the Troubleshooting Guide
- Want to contribute? β See the Contributing Guide
- Need API details? β View the Contributing Guide
We welcome contributions to Thread It! Whether you want to fix bugs, add features, or improve documentation, your help is appreciated.
Quick Start for Contributors:
- Read the Contributing Guide
- Fork the repository
- Set up your development environment
- Make your changes
- Submit a pull request
For detailed development setup, code style guidelines, testing requirements, and submission process, see our comprehensive Contributing Guide.
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License Summary: You can use, modify, and distribute this project freely for commercial or private use. No warranty is provided.
- Discord.py - The excellent Python library for Discord bot development
- Discord - For providing the platform and API
- Contributors - Everyone who has contributed to making Thread It better
- Community - Users who provide feedback and report issues
Made with β€οΈ by @wei