+1
bot/.env.example
+1
bot/.env.example
+1
bot/README.md
+1
bot/README.md
···
23
23
| `MIN_PHRASE_WORDS` | `4` | minimum words in phrase to match |
24
24
| `POSTING_ENABLED` | `false` | must be `true` to actually post |
25
25
| `COOLDOWN_MINUTES` | `120` | don't repost same bufo within this time |
26
+
| `EXCLUDE_PATTERNS` | `sad,crying,...` | exclude bufos matching these patterns |
26
27
| `JETSTREAM_ENDPOINT` | `jetstream2.us-east.bsky.network` | jetstream server |
27
28
28
29
## local dev
+3
bot/src/bufo_bot/config.py
+3
bot/src/bufo_bot/config.py
···
15
15
# cooldown: don't repost same bufo within this many minutes
16
16
cooldown_minutes: int = 120
17
17
18
+
# exclude bufos matching these patterns (comma-separated regex)
19
+
exclude_patterns: str = "what-have-you-done,what-have-i-done,sad,crying,cant-take"
20
+
18
21
model_config = {"env_file": ".env", "extra": "ignore"}
19
22
20
23
+7
-2
bot/src/bufo_bot/main.py
+7
-2
bot/src/bufo_bot/main.py
···
57
57
58
58
def load_bufos() -> list[Bufo]:
59
59
"""fetch the list of bufos from the find-bufo API"""
60
-
api_url = "https://find-bufo.com/api/search?query=bufo&top_k=2000&alpha=0"
60
+
params = {
61
+
"query": "bufo",
62
+
"top_k": 2000,
63
+
"alpha": 0,
64
+
"exclude": settings.exclude_patterns,
65
+
}
61
66
62
67
try:
63
-
resp = httpx.get(api_url, timeout=30)
68
+
resp = httpx.get("https://find-bufo.com/api/search", params=params, timeout=30)
64
69
resp.raise_for_status()
65
70
data = resp.json()
66
71
bufos = [