2
0
Fork 0
forked from zynk/zynk

Improved Wikipedia results formatting and article extracts. (0.43.1)

- Changed multi-result mode from a single pipe-separated message to
  individual messages: each result is now its own IRC message (Title —
  snippet) followed by a separate Read full article: LINK message.
- Removed numbering from multi-result messages.
- Changed single-result extract to show the first chapter instead of only
  the introductory paragraph by removing exintro=true from the Extracts
  API URL.
- Increased extract character limit from 500 to 800 (exchars=800).
- Added truncation indicator (...) for extracts approaching the character
  limit.
- Added Read full article: prefix to the single-result link message.
- Updated CHANGELOG.md with 0.43.1 entry.
This commit is contained in:
Johannes Findeisen 2026-07-26 00:59:16 +02:00
commit 013242f057
3 changed files with 32 additions and 37 deletions

View file

@ -1,8 +1,17 @@
2026.07.26 - Improved Wikipedia results formatting and article extracts. (0.43.1)
- Changed multi-result mode from a single pipe-separated message to individual messages: each result is now sent as its own IRC message (`Title — snippet`) followed by a separate "Read full article: LINK" message. This makes results easier to read in busy channels and ensures each article link is immediately visible.
- Removed numbering from multi-result messages (was `1. Title — ...`, now just `Title — ...`).
- Changed single-result extract to show the first chapter instead of only the introductory paragraph: removed `exintro=true` from the Extracts API URL so the API returns the full article content up to the character limit.
- Increased the extract character limit from 500 to 800 characters (`exchars=800`) to show more article content per result.
- Added truncation indicator ("...") appended to single-result extracts when the text reaches 790+ characters (near the `exchars` limit).
- Added "Read full article: LINK" follow-up message to every single-result response (previously only sent the bare URL as a second message, now uses the "Read full article: " prefix).
2026.07.26 - Wikipedia search command. (0.43.0)
- Added `!wp <search terms>` command: searches Wikipedia using the MediaWiki API (`action=query&list=search`) and displays results. Accepts multiple keywords (e.g. `!wp quantum physics`). Rate-limited via `rate_limit_check()`.
- Single-result mode: when the search returns exactly one article, fetches the first chapter via the Extracts API (`action=query&prop=extracts`, up to 800 characters) and sends the article title, intro text, and a "Read full article: LINK" message. Appends "..." if the extract was truncated.
- Multi-result mode: when the search returns 2-5 articles, sends a compact numbered list with short snippets (truncated to 60 chars) separated by pipes. Each result is followed by a "Read full article: LINK" message. Appends "..." if the result list was truncated.
- Multi-result mode: when the search returns 2–5 articles, sends a compact numbered list with short snippets (truncated to 60 chars) separated by pipes. Each result is followed by a "Read full article: LINK" message. Appends "..." if the result list was truncated.
- Added self-contained JSON parser helpers: `wp_json_get_string()` extracts string values by key, `wp_json_next_array_item()` iterates JSON array objects, `wp_decode_json_string()` handles JSON escape sequences including `\uXXXX` Unicode.
- Added `wp_url_encode()` for percent-encoding search queries and article titles in API URLs (RFC 3986 compliant, spaces as `+`).
- Added `wp_codepoint_to_utf8()` to encode Unicode code points as UTF-8 bytes (handles U+0000 through U+10FFFF).
@ -10,7 +19,7 @@
- Added `wp_hex_digit()` to convert hexadecimal characters to numeric values.
- Added `WITH_WP` CMake feature toggle (ON by default) with compile definition `HAS_CMD_WP`.
- Added `!wp` to the `!help` command listing.
- Added comprehensive doc comments to all 9 functions in `cmd_wp.h`.
- Added comprehensive doc comments to all nine functions in `cmd_wp.h`.
2026.07.25 - Comprehensive flood protection: per-poll limits, userhost rate limiting, outgoing throttle. (0.42.0)