Make new wikigame command available everywhere. - annna - Annna the nice friendly bot.
(HTM) git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
---
(DIR) commit 359b5b4c612a440421484f273f89005f74f0eec2
(DIR) parent 825d9f00a6fe94c837259571eb70e7c54a3f524a
(HTM) Author: Annna Robert-Houdin <annna@bitreich.org>
Date: Wed, 8 Jul 2026 15:57:23 +0200
Make new wikigame command available everywhere.
Diffstat:
M annna-message-common | 23 ++++++++++++++---------
M gpt | 2 +-
M wikipediagame | 12 ++++++++++--
3 files changed, 25 insertions(+), 12 deletions(-)
---
(DIR) diff --git a/annna-message-common b/annna-message-common
@@ -397,16 +397,21 @@ case "${IRC_PRIVMSG_TEXT}" in
printf "https://soho.nascom.nasa.gov/data/realtime/c3/512/latest.jpg\n"
} | shuf -n 1)"
annna-say "${IRC_CMD_USER}, see for yourself: ${sunuri}";;
-"${IRC_USER}, wikigame "*)
+"${IRC_USER}, wikigame"*)
wikipediagameargs="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f 3-)"
- annna_say "${wikipediagameargs}"
- case "${wikipediagameargs}" in
- "init"*|"guess "*|summary|hint|more|giveup)
- wikipediagamecmd="$(printf "%s\n" "${wikipediagameargs}" | cut -d' ' -f 1)"
- wikipediagameargv="$(printf "%s\n" "${wikipediagameargs}" | cut -d' ' -f 2-)"
- say_text="$(wikipediagame "${wikipediagamecmd}" "${wikipediagameargv}")"
- [ -n "${say_text}" ] && annna-say "wikigame: ${say_text}";;
- esac;;
+ annna-say "${wikipediagameargs}"
+ if [ -z "${wikipediagameargs}" ];
+ then
+ annna-say "Try: wikigame init|summary|hint|more|guess guessstr|giveup"
+ else
+ case "${wikipediagameargs}" in
+ "init"*|"guess "*|summary|hint|more|giveup)
+ wikipediagamecmd="$(printf "%s\n" "${wikipediagameargs}" | cut -d' ' -f 1)"
+ wikipediagameargv="$(printf "%s\n" "${wikipediagameargs}" | cut -d' ' -f 2-)"
+ say_text="$(wikipediagame "${wikipediagamecmd}" "${wikipediagameargv}")"
+ [ -n "${say_text}" ] && annna-say "wikigame: ${say_text}";;
+ esac
+ fi;;
"${IRC_USER}, bleep bloop"*) annna-say "${IRC_CMD_USER}, bloop bleep.";;
"${IRC_USER}, bloop bleep"*) annna-say "${IRC_CMD_USER}, bleep bloop.";;
"${IRC_USER}, bloop bloop"*) annna-say "${IRC_CMD_USER}, bleep bleep.";;
(DIR) diff --git a/gpt b/gpt
@@ -1,6 +1,6 @@
#!/bin/sh
-export PATH="$HOME/bin:$PATH"
+export PATH="$HOME/bin:$PATH:/br/bin"
# TODO: Remove due to outdated model.
function local_llama() {
(DIR) diff --git a/wikipediagame b/wikipediagame
@@ -10,6 +10,8 @@ import getopt
import wikipedia as w
import json
import random
+import time
+from datetime import timedelta
from difflib import SequenceMatcher
def usage(app):
@@ -25,7 +27,7 @@ def concealtitle(s, title):
def geturi(wpage):
wuri = wpage.url
- return wuri.replace("https://en.wikipedia.org/wiki", "gopher://gopherpedia.com/0")
+ return wuri.replace("https://en.wikipedia.org/wiki", "gophers//bitreich.org/0/pedia/txt")
def endgame(hintpath, titlepath):
if os.path.exists(hintpath):
@@ -50,6 +52,10 @@ def main(args):
newtitle = 0
title = None
+ w.set_user_agent("WikiGameBot/0.2 (https://bitreich.org; 20h@r-36.net)")
+ w.set_rate_limiting(True, timedelta(seconds=1))
+ time.sleep(1)
+
for o, a in opts:
if o == "-h":
usage(args[0])
@@ -112,7 +118,9 @@ def main(args):
printsummary = 1
if printsummary == 1:
- summary = w.summary(title).replace("\n", " ")
+ if summary == None:
+ summary = w.summary(title)
+ summary = summary.replace("\n", " ")
print(concealtitle(summary, title))
if os.path.exists(hintpath):