Fork 0
Motivation Telegram bot
Go to file
Felix 4fb460138f Update README, add example config.py 2022-01-15 22:28:19 +01:00
README.md Update README, add example config.py 2022-01-15 22:28:19 +01:00
config.example.py Update README, add example config.py 2022-01-15 22:28:19 +01:00
convert.txt Initial commit 2022-01-15 16:13:56 +01:00
motivationbot.py Initial commit 2022-01-15 16:13:56 +01:00
motivationbot.service Initial commit 2022-01-15 16:13:56 +01:00
motivationbot.timer Initial commit 2022-01-15 16:13:56 +01:00
requirements.txt Initial commit 2022-01-15 16:13:56 +01:00


Motivation Telegram bot

Bot that sends a daily motivational message with an image via Telegram private conversation.

Register bot

Create a new bot from @botfather:

<Bot Name>
<Bot Handle> (for t.me/bot_handle)

Start conversation with bot at t.me/<bot_handle>

Forward piece of convo to @getidsbot, copy channel id

Note: This is not a bot that will post in a channel, but rather send messages directly to the user

Install packages

The motivation bot requires the python-telegram-bot package.

Either install it in a virtual environment:

virtualenv .venv-bot
.venv-bot/bin/pip install python-telegram-bot

Or, for distributions with native packages, install it:

Arch Linux

pacman -S python-telegram-bot


apt install python3-python-telegram-bot

Adjust images and captions

Put images into images/ directory. They should be pre-formatted and not too large, as the bot has no way of compressing them before uploading.

An example config is provided as config.example.py. Rename it to config.py and fill in your captions:

    "My motivational message",
    "My even more motivational message",

Run bot

Set the following environment variables with bot token and chat id:

export MOTIVATION_BOT_TOKEN='<bot-token>'
export MOTIVATION_BOT_CHAT_ID='<my-chat-id>'

Run the bot on a timer, either via systemd timers or cronjobs. Alternatively, use the primitive python sleep()-based timer in the __main__ function.