57 lines
1.8 KiB
Raw Permalink Normal View History

# SonyDevWorld Telegram Bot
The bot that powers [](
*Neither affiliated nor endorsed by Sony Mobile*
### Requirements:
You need to have `python3` installed with the `requests` module.
Further, you need to supply token and channel id via environment variables:
get one from [](,
e.g. `1234567890:ABCDb1o0-ASDKHKJ3oiavKJDSFKJHkjwebb`
- `SONYDEVWORLD_BOT_CHANNEL`: Channel id to post to,
e.g. `-1000000000000` for [](
You can quickly obtain channel info from [@getidsbot](
### Running
export SONYDEVWORLD_BOT_TOKEN=<my-token>
export SONYDEVWORLD_BOT_CHANNEL=<my-channel-id>
It makes sense to run this bot maybe once an hour to avoid hammering the Sony
Dev World API.
Set `export DEBUG=true` to run in debug mode, set `export OFFLINE=True` to run
in offline mode after you've saved `items.json`.
### Deploying
For deploying, a simple `systemd` unit file with a timer is included.
After you've supplied your token inside the `.service` file and copied the unit
2021-01-02 23:36:21 +01:00
and timer files into `/etc/systemd/system/`, you can run the service
periodically via
`systemctl daemon-reload` and then
`systemctl reenable --now sonydevworldbot.timer`
For convenience, there is also an [ansible role][ansible] available.
### Details
`` does all the heavy lifting for you. It posts to the Telegram
bot API at `<token>/sendMessage`
The last posted item's `guid` info is saved to `laststatus.txt`. It would look
something like `file-download-786918`.
2020-12-30 01:29:11 +01:00
## License
2020-12-30 16:41:29 +01:00
MIT, see [](
2021-01-02 23:36:21 +01:00