bitbot-irc / bitbot

https://bitbot.dev | Python3 event-driven modular IRCv3 bot 🤖
GNU General Public License v2.0
136 stars 50 forks source link

Wikipedia module could be insensitive to case, redirects #227

Open prdes opened 4 years ago

prdes commented 4 years ago

Hi Jesopo, These were my concerns, pls let me know what you feel about what is feasible and what isn't:

  1. The first word of a multi word wiki search seems to not worry about the case but the second word seems to require me to put in the case sensitive input.
  2. How do redirects and a 'query' with multiple options (disambiguation) work. a. Do redirects work to show accurate link or will it 404 b. Incases of disambiguation where a 'input query' results in multiple options can we add (cmd prefix)1 or 2 or 3 .. there is already ~,!,$more to show the rest of the text.
jesopo commented 4 years ago

I'm not sure what I can do about case insensitivity but I'll read the mediawiki API docs when I next get the chance.

Disambiguation is difficult and not standardised so we'd have to detect it and somewhat-fuzzy parse it which sucks but.... oh well. I'll look around at other wikipedia plugins for IRC bots to see how they did it.

I like the idea of 2a. maybe something like !page 2.

examknow commented 4 years ago
  1. The first word of a multi word wiki search seems to not worry about the case but the second word seems to require me to put in the case sensitive input.

This is not a BitBot issue. The MediaWiki software automatically capitalizes the first word in a page title. I'm not sure why it does this but it's not something that can be fixed on BitBot's end.

2. How do redirects and a 'query' with multiple options (disambiguation) work.

The MediaWiki API will automatically resolve redirects if the 'redirects' parameter is set to '1'. For an example, see https://en.wikipedia.org/wiki/Special:ApiSandbox#action=query&format=json&prop=extracts%7Cinfo&titles=WP%3ABEANS&redirects=1&exchars=500 where [[WP:BEANS]] is resolved to [[Wikipedia:BEANS]] and then again to [[Wikipedia:Don't stuff beans up your nose]]. I hope this helps to clear some things up.