- Python 99.4%
- Dockerfile 0.4%
- Shell 0.2%
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [pydiscourse](https://github.com/bennylope/pydiscourse) | project.dependencies | minor | `==1.1.1` → `==1.7.0` | --- ### Release Notes <details> <summary>bennylope/pydiscourse (pydiscourse)</summary> ### [`v1.7.0`](https://github.com/bennylope/pydiscourse/blob/HEAD/HISTORY.rst#170) [Compare Source](https://github.com/bennylope/pydiscourse/compare/v1.6.1...v1.7.0) - Possible breaking change: Change `search()` term paramater from `term` to `q`, fixes search. Thanks [@​weber-s](https://github.com/weber-s) - Add support for Python 3.12 ### [`v1.6.1`](https://github.com/bennylope/pydiscourse/blob/HEAD/HISTORY.rst#161) [Compare Source](https://github.com/bennylope/pydiscourse/compare/v1.6.0...v1.6.1) - Adds `posts_by_number` endpoint from [@​Dettorer](https://github.com/Dettorer) ### [`v1.6.0`](https://github.com/bennylope/pydiscourse/blob/HEAD/HISTORY.rst#160) [Compare Source](https://github.com/bennylope/pydiscourse/compare/v1.5.0...v1.6.0) - Breaking: `toggle_gravatar`, `pick_avatar`, `create_group` now *require* keyword arguments where keyword arguments were used. This *may* break existing code if you have not referenced these by keyword! - Introduced `ruff` and `black` into pre-commit hook - Added `lint` job to GitHub Actions, tests will run if and only if lint job passes. - Sundry code cleanup ### [`v1.5.0`](https://github.com/bennylope/pydiscourse/blob/HEAD/HISTORY.rst#150) [Compare Source](https://github.com/bennylope/pydiscourse/compare/v1.3.0...v1.5.0) - Owner creation endpoint update from [@​akhmerov](https://github.com/akhmerov) - Python 3.11 support from [@​Dettorer](https://github.com/Dettorer) - Group membership fixes from [@​inducer](https://github.com/inducer) - Rate limiting fixes from [@​inducer](https://github.com/inducer) - Latest posts endpoint from [@​max-lancaster](https://github.com/max-lancaster) ### [`v1.3.0`](https://github.com/bennylope/pydiscourse/blob/HEAD/HISTORY.rst#130) [Compare Source](https://github.com/bennylope/pydiscourse/compare/v1.2.0...v1.3.0) - Add fix for handling global Discourse timeouts - Add group owners - Update API for add\_group\_owner ### [`v1.2.0`](https://github.com/bennylope/pydiscourse/blob/HEAD/HISTORY.rst#120) [Compare Source](https://github.com/bennylope/pydiscourse/compare/v1.1.2...v1.2.0) - BREAKING? Dropped support for Python 2.7, 3.4, 3.5 - Added numerous new endpoint queries - Updated category querying ### [`v1.1.2`](https://github.com/bennylope/pydiscourse/blob/HEAD/HISTORY.rst#112) [Compare Source](https://github.com/bennylope/pydiscourse/compare/v1.1.1...v1.1.2) - Fix for Discourse users API change </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My43Ni4zIiwidXBkYXRlZEluVmVyIjoiNDMuNzYuMyIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Co-authored-by: Soeren Wegener <wegener92@gmail.com> Reviewed-on: #5 Co-authored-by: renovate <bot+renovate@flipdot.org> Co-committed-by: renovate <bot+renovate@flipdot.org> |
||
|---|---|---|
| .forgejo/workflows | ||
| .run | ||
| src | ||
| templates | ||
| tests | ||
| .env.example | ||
| .env.unittests | ||
| .flake8 | ||
| .gitignore | ||
| .pre-commit-config.yaml | ||
| build_docker.sh | ||
| compose.yaml | ||
| Dockerfile | ||
| pyproject.toml | ||
| README.md | ||
| renovate.json | ||
| run_docker.sh | ||
| setup.cfg | ||
| uv.lock | ||
flipdot Discourse bot
Usage
docker run -d -e DISCOURSE_API_KEY=fefe flipdot/forumbot
# if you want to run on another discourse instance:
docker run -d -e DISCOURSE_API_KEY=fefe -e DISCOURSE_USERNAME=hello -e DISCOURSE_HOST=https://forum.example.com flipdot/forumbot
Deployment
Changes on the master branch are automatically build into a docker image and published at docker hub. After it is published, you need to adjust this ansible playbook
Checkout if a change to the ansible playbook is automatically deployed yet - at the time of writing this, you need to run the playbook manually. See details over at the other repository.
Developing
Compose setup
If you are not able to get an API key for forum.flipdot.org, try the compose setup:
docker compose up
Go to http://localhost:3000/ and login with user user@example.com and password bitnami123
Running
Clone this repo, make your changes, build a new container:
./build_docker.sh
DISCOURSE_API_KEY=fefe ./run_docker.sh
# or with the test user
DISCOURSE_API_KEY=fefe DISCOURSE_USERNAME=flipbot_test ./run_docker.sh
Or, if you want to develop without docker:
uv sync
DISCOURSE_API_KEY=fefe uv run python src/app.py
# or with the test user
DISCOURSE_API_KEY=fefe DISCOURSE_USERNAME=flipbot_test uv run python src/app.py
You can get the credentials of flipdot_test in our forum: https://forum.flipdot.org/t/api-key-fuer-flipbot-test/3755
Copy .env.example to .env and set the API key there, so you don't have to set it every time.
cp .env.example .env
Execute tests:
PYTHONPATH=src uv run pytest
How to add a job?
Start by copying src/tasks/hello_world.py. You can run your new task directly:
uv run python src/app.py --dry --run_task hello_world
...where "hello_world" is the name of the python file.
Modify the main() function:
def main(client: DiscourseClient) -> None:
# Do your stuff here.
# You can use the client object to interact with discourse
pass
Next, open src/app.py. Add an import tasks.my_awesome_task to the top of the file.
Schedule your task inside the function schedule_jobs:
schedule.every().day.at('13:37').do(tasks.my_awesome_task.main, client)
Take a look at schedule to see how to specify when to run your task.