Users of your channel can post messages in channels using this bot. They simply need to write a message to bot. Bot will prompt them if they want their message to be posted to your public channel with link to author. If the user agrees, their message will be posted to the channel. This may be useful for channels where users can buy/sell stuff. Currently, bot supports text and photos.
- Create new telegram bot with @BotFather or use existing one
- Create a new channel in telegram or use existing one
- Add your bot to the channel as administrator
- Clone this repo
- Setup virtual environment and install dependencies:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
- Create directory for logs:
mkdir logs - Create bot_settings.py file:
touch bot_settings.py - Add the following to you bot_settings file:
# Replace value below with bot token that you can receive from BotFather
BOT_TOKEN = "YOUR_BOT_TOKEN"
# Replace value below with ID of your channel.
# You can see it in web version of telegram
# Keep in mind that you should append -100 at the beginning
# For example, if your channel's ID is -12304577778,
# the value should be -10012304577778
CHANNEL_ID = "-100<YOUR_CHANNEL_ID>"Example of bot settings for bot with token 123456789:hgdywtwhq8vQWERTYUIOPASDFGHKJKMNNBU
and channel with id -1123456789:
BOT_TOKEN = "123456789:hgdywtwhq8vQWERTYUIOPASDFGHKJKMNNBU"
CHANNEL_ID = "-1001123456789"- Activate venv:
source venv/bin/activate - Start bot:
./main.py