2
0
Fork 0
forked from zynk/zynk

Wikipedia search command (!wp), version 0.43.0

- Add !wp <search terms> command: searches Wikipedia via MediaWiki API
  (action=query&list=search), displays article titles, snippets, and links.
  Single-result mode fetches the first chapter via Extracts API (exchars=800);
  multi-result mode shows a numbered list with short snippets and per-result
  Read full article links.
- Add self-contained JSON parser helpers: wp_json_get_string(),
  wp_json_next_array_item(), wp_decode_json_string() with \uXXXX Unicode
  support.
- Add wp_url_encode() (RFC 3986), wp_codepoint_to_utf8(), wp_strip_html(),
  wp_collapse_spaces(), wp_hex_digit().
- Add WITH_WP CMake feature toggle (ON by default, HAS_CMD_WP compile def).
- Add !wp to the !help command listing.
- Add doc comments to all 9 functions in cmd_wp.h.
- Update CHANGELOG.md with 0.43.0 entry.
- Update README.md: add Wikipedia to features list, feature toggles table,
  IRC commands utilities table, and minimal build command.
This commit is contained in:
Johannes Findeisen 2026-07-26 00:23:38 +02:00
commit 19b07fa76f
7 changed files with 443 additions and 5 deletions

View file

@ -1,6 +1,6 @@
# zynk - An IRC bot
An IRC bot in C. Features a key-value store backed by SQLite3, weather lookups via wttr.in, stock quotes, calculator, time, user tracking, YouTube title lookups, and AI-powered replies.
An IRC bot in C. Features a key-value store backed by SQLite3, weather lookups via wttr.in, stock quotes, calculator, time, user tracking, YouTube title lookups, Wikipedia search, and AI-powered replies.
## This is a fork!
@ -20,6 +20,7 @@ I want to thank Armin for his work and for sharing his code with me. Take a look
- **AI Queries**: Ask questions via `!ai` or by addressing the bot; powered by `opencode`
- **Code Changes**: AI-powered code editing with auto-recompile and hot reload
- **YouTube Titles**: Look up video titles with `!yt <url>` (via YouTube oEmbed API)
- **Wikipedia Search**: Search Wikipedia with `!wp <query>` (via MediaWiki API)
- **Chat Greetings**: Responds to `hi`, `hello`, `hey`, `bye`, and more
- **Hot Reload**: Reload or restart without leaving channels, losing your nick, or dropping voice mode
- **TLS**: Secure connections via OpenSSL
@ -90,6 +91,7 @@ Available options (the `!command` shown in parentheses):
| `WITH_RELOAD` | `!reload` | Hot reload (ops only) | ON |
| `WITH_RESTART` | `!restart` | Restart (ops only) | ON |
| `WITH_YT` | `!yt` | YouTube title lookup (requires curl) | ON |
| `WITH_WP` | `!wp` | Wikipedia search (requires curl) | ON |
| `WITH_GREETING_OR_CHAT` | `<nick>: <text>` | Greeting/chat with AI fallback | ON (can not be disabled) |
### Minimal build
@ -102,7 +104,7 @@ cmake -B build \
-DWITH_STOCK=OFF -DWITH_CALC=OFF -DWITH_TIME=OFF -DWITH_SEEN=OFF \
-DWITH_TELL=OFF -DWITH_GITLOG=OFF -DWITH_CHANGELOG=OFF -DWITH_AI=OFF \
-DWITH_CODE=OFF -DWITH_REBUILD=OFF -DWITH_UPTIME=OFF -DWITH_RELOAD=OFF \
-DWITH_RESTART=OFF -DWITH_YT=OFF -DWITH_GREETING_OR_CHAT=OFF
-DWITH_RESTART=OFF -DWITH_YT=OFF -DWITH_WP=OFF -DWITH_GREETING_OR_CHAT=OFF
cmake --build build
```
@ -176,6 +178,7 @@ rm -rf build
| `!seen <nick>` | Check when a user was last seen |
| `!tell <nick> <message>` | Leave a message for an offline user |
| `!yt <url>` | Show YouTube video title and channel name |
| `!wp <query>` | Search Wikipedia and show article info |
| `!gitlog [count]` | Show recent git commits with links (default: 1, max: 10) |
| `!changelog [count]` | Show changelog entries (default: 1, max: 10) |