A Telegram bot @pyworldwide_socials_bot that publishes your posts on Bluesky and Fosstodon with just a few taps! 📱✨
- Python 3.11+ installed
- uv package manager
- A Telegram bot token (obtained from @BotFather)
- Bluesky account credentials
- A Fosstodon (Mastodon) access token
-
Clone the project:
git clone https://github.com/pyworldwide/socials-bot.git cd socials-bot -
Install the dependencies:
uv sync --frozen
-
Create a
.envfile with your credentials:TELEGRAM_TOKEN=your_telegram_bot_token BLUESKY_USERNAME=your_bluesky_username BLUESKY_PASSWORD=your_bluesky_password MASTODON_ACCESS_TOKEN=your_mastodon_access_token AUTHORIZED_USERS=[123456789, 987654321]Replace the values with your actual credentials. For
AUTHORIZED_USERS, include the Telegram user IDs of people who should be allowed to use the bot (as a JSON array). -
To get your Telegram user ID, you can talk to @userinfobot on Telegram.
-
For the Mastodon access token, follow these steps:
- Log in to your Fosstodon account
- Go to Preferences > Development > New Application
- Name your application, give it the
write:statusesscope - Submit and copy the access token
- Build the docker image:
docker build -t socials-bot . - Run the bot:
docker run --env-file ./.env socials-bot
- To run in background (detached mode):
docker run -d --env-file ./.env --name socials-bot socials-bot
- View logs if running in detached mode:
docker logs -f socials-bot
- Run the bot:
uv run python3 main.py
Once your bot is running, you can interact with it via Telegram:
/start- Shows welcome message and instructions 👋/help- To see the available commands 📚/post- Start the posting process ✏️/list_scheduled- List all your scheduled posts 📅/delete_scheduled [post_id]- Delete a scheduled post 🗑️/cancel- Cancel the current operation ❌
If you encounter issues:
- Check your credentials in the
.envfile 🔑 - Ensure your bot has the necessary permissions on Telegram 👮♀️
- Verify your Bluesky and Mastodon credentials are correct 🔐
- Check the logs for any error messages 📊
For persistent storage of scheduled posts, the bot creates a scheduled_posts.json file. Make sure the directory is writable. 💾
Contributions are welcome! Feel free to open issues or submit pull requests.
This project is licensed under the CC0 1.0 Universal - see the LICENSE file for details.
Happy cross-posting! 🎉