• Python 99.4%
  • Dockerfile 0.4%
  • Shell 0.2%
Find a file
Soeren Wegener b1f86f6f5e
Some checks failed
CI / tests (push) Successful in 29s
CI / pre-commit (push) Successful in 35s
CI / build (push) Failing after 1m5s
mv .github .forgejo (#2)
Reviewed-on: #2
Co-authored-by: Soeren Wegener <wegener92@gmail.com>
Co-committed-by: Soeren Wegener <wegener92@gmail.com>
2026-03-02 22:58:09 +00:00
.forgejo/workflows mv .github .forgejo (#2) 2026-03-02 22:58:09 +00:00
.run Add idea run configuration 2026-02-24 23:48:19 +01:00
src Robust datetime formatting in templates 2026-02-28 17:17:11 +01:00
templates Robust datetime formatting in templates 2026-02-28 17:17:11 +01:00
tests Robust datetime formatting in templates 2026-02-28 17:17:11 +01:00
.env.example Build announcement post 2024-10-19 04:19:21 +02:00
.env.unittests Add dummy credentials 2026-02-08 17:17:04 +01:00
.flake8 pre-commit run --all-files 2024-10-19 03:25:36 +02:00
.gitignore pre-commit run --all-files 2024-10-19 03:25:36 +02:00
.pre-commit-config.yaml Replace black and flake8 with ruff. 2026-02-08 00:29:18 +01:00
build_docker.sh pre-commit run --all-files 2024-10-19 03:25:36 +02:00
compose.yaml pre-commit run --all-files 2024-10-19 03:25:36 +02:00
Dockerfile Fix build by copying README.md into container 2025-10-03 02:33:42 +02:00
pyproject.toml Improve formatting of md file 2026-02-13 02:53:08 +01:00
README.md Merge pull request #32 from flipdot/imap-support 2026-02-08 14:53:49 +01:00
run_docker.sh pre-commit run --all-files 2024-10-19 03:25:36 +02:00
setup.cfg Lintfix, add pre-commit 2024-10-19 03:01:11 +02:00
uv.lock Adjust queue generation and shuffling. 2026-02-13 02:32:44 +01:00

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.