poetrybot
poetrybot is a Telegram bot to quote poems between friends. It’s written in Python and it is released under the EUPL 1.2 license.
Friends are defined by an allow list in which every account have to be in order to to use the bot. The management of the bot is provided by a REST API defined in the subpackage poetrybot.web.
Installation
Create your bot using Telegram @BotFather.
Install (preferably inside a virtualenv) the bot using:
pip install poetrybotThe bot uses environment variables as configuration, you have to export the following before starting it:
export AUTH_TOKEN=<my secret auth token> export DATABASE_URL=sqlite:////absolute/path/to/poetrybot.db export TELEGRAM_TOKEN=<telegram bot API key>AUTH_TOKEN is used to authenticate to the REST API used to manage the bot. Full specification is in the docs/openapi.yml file. Just create a long enough random string, for example using pwgen -sy 50.
Launch the bot:
poetrybotTo use the REST API install a WSGI HTTP Server, for example gunicorn, and then:
gunicorn poetrybot.web.wsgi:appUse the REST API to insert allowed friends, poets and poems. The fastest way to look at the API is to load the API specification into https://editor.swagger.io
An alternative is to clone the repository and use the provided Dockerfile.
Usage
To use the bot you only have to use the /quote command. The bot can be added to one or more channels but it’s not required. But remember that only friends in allow list will be able to interact with the bot.
The /quote command used without parameters will make the bot to quote a random poem, but optionally the author and the argument can be specified:
/quote returns a random poem;
/quote AUTHOR returns a random poem by AUTHOR.
AUTHOR is the name or part of the name of the poet case insensitive:
/quote Giovanni Pascoli /quote pascoli /quote ascolwill return a random poem by Giovanni Pascoli, if you don’t have another poet with ascol inside the name;
/quote AUTHOR about ARGUMENT returns a random poem by AUTHOR about ARGUMENT.
ARGUMENT is, like AUTHOR, case insensitive and can be part of a word. about is, instead, case sensitive;
/quote about ARGUMENT returns a random poem about ARGUMENT.
Metadata
Release files for poetrybot 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| poetrybot-0.2.0.tar.gz | 13.7 kB | Without provenance | Details for poetrybot-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| poetrybot-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for poetrybot-0.2.0-py3-none-any.whl |
Total release size: 31.1 kB
Release files / poetrybot-0.2.0.tar.gz
| Download URL | poetrybot-0.2.0.tar.gz |
|---|---|
| Size | 13.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cfec4d2e9c43949ef7740031425434f8aac8a8c6bf02075dc964e067e8bb7534
|
|
BLAKE2b-256 checksum How to use checksums |
7b270e151d0d9c9dc65538885cc6f6308a53bcc865f1fd04123540af8a6ec5b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.2 CPython/3.11.1 Linux/6.1.0-3-amd64
|
Release files / poetrybot-0.2.0-py3-none-any.whl
| Download URL | poetrybot-0.2.0-py3-none-any.whl |
|---|---|
| Size | 17.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a11362cd28609a259a6e71662809b172b5d48c6c76983959e14033ca65ba5262
|
|
BLAKE2b-256 checksum How to use checksums |
d43144c823622a34f6d53bb6234ca383f706bc364c01c3e7245eccc0c6698d18
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.2 CPython/3.11.1 Linux/6.1.0-3-amd64
|
Security for poetrybot 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.