Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# python venv
venv
.venv

# ruff (linter / formatter) cache
.ruff_cache

# config file with settings
config.ini
Expand All @@ -8,4 +12,3 @@ config.ini
src/trashbot_data

ideas.md

18 changes: 18 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.5.3
hooks:
# Run the linter.
- id: ruff
# Run the formatter.
- id: ruff-format
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python 3.8.19
15 changes: 12 additions & 3 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,16 @@ Visit [https://t.me/zh_trashbot](https://t.me/zh_trashbot) or use `@zh_trashbot`
You don't need to deploy the bot to use it. For using the bot, just follow the link above. If - for whatever reason - you want to deploy (a copy of) this bot, you will need to:

- clone this repository,
- create a virtual environment (use python 3.6 or later),
- install the dependencies (into your virtual environment): `pip install -r requirements.txt`,
- copy `config.ini.example` to `config.ini`, get a [Telegram bot token](https://core.telegram.org/bots#creating-a-new-bot) and configure it in `config.ini`,
- install [asdf-vm](https://asdf-vm.com) and [asdf-python](https://github.com/asdf-community/asdf-python) to manage the python version,
- run `asdf global python system` to use the system's python version (if installed) outside this project,
- run `asdf install` to install the configured python version,
- run `python -m venv .venv/` to create the virtual environment,
- run `source .venv/bin/activate` to activate the virtual environment,
- run `pip install -r requirements.txt` to install the dependencies,
- copy `config.ini.example` to `config.ini`,
- get a [Telegram bot token](https://core.telegram.org/bots#creating-a-new-bot) and configure it in `config.ini`,
- run `python trashbot.py` from within the `src/` folder (or submit a PR to fix the fact that we currently have a hard-coded relative path to the config file)

## VSCode setup

Recommended extensions are [ruff](https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff) and [Code Spell Checker](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker).
1 change: 0 additions & 1 deletion config.ini.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
[api.telegram.org]
token = Your-telegram-bot-token-here

15 changes: 15 additions & 0 deletions cspell.config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: "0.2"
ignorePaths:
- .venv
dictionaryDefinitions: []
dictionaries: []
words:
- trashbot
- venv
- Züri
ignoreWords:
- cargotram
- etram
- levelname
- tada
import: []
10 changes: 10 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
certifi==2020.6.20
cffi==1.14.3
cfgv==3.4.0
cryptography==3.1.1
decorator==4.4.2
distlib==0.3.8
filelock==3.15.4
identify==2.6.0
nodeenv==1.9.1
platformdirs==4.2.2
pre-commit==3.5.0
pycparser==2.20
python-telegram-bot==12.8
PyYAML==6.0.1
ruff==0.5.3
six==1.15.0
tornado==6.0.4
virtualenv==20.26.3
Loading