Class: RWikiBot
- Inherits:
-
Object
- Object
- RWikiBot
- Defined in:
- lib/rwikibot.rb
Overview
This is the main bot object. The goal is to represent every API method in some form here, and then write seperate, cleaner scripts in individual bot files utilizing this framework. Basically, this is an include at best.
Instance Attribute Summary collapse
-
#botname ⇒ Object
Returns the value of attribute botname.
-
#config ⇒ Object
Returns the value of attribute config.
-
#http ⇒ Object
Returns the value of attribute http.
Instance Method Summary collapse
-
#all_pages(options = nil) ⇒ Object
List.
-
#backlinks(titles, options = nil) ⇒ Object
List.
-
#embedded_in(title, options = nil) ⇒ Object
List.
-
#info(titles) ⇒ Object
Prop = Info.
-
#initialize(name = "TestBot", username = 'RWikiBot', password = 'rwikibot', domain = 'en', api_path = 'http://localhost:8888/wiki/api.php', wikicookieprefix = 'wikidb_wiki') ⇒ RWikiBot
constructor
New bots hope for three attributes, but require none.
-
#log_events(options = nil) ⇒ Object
List.
-
#login ⇒ Object
Login.
-
#make_unique(array) ⇒ Object
The point of this method is to iterate through an array of hashes, which most of the other methods return, and remove multiple instances of the same wiki page.
-
#normalize(title) ⇒ Object
Query.
-
#page_exists?(title) ⇒ Boolean
This is a little something I cooked up because it seems like a totally logical thing for bots to want to do.
-
#pageid_to_title(id) ⇒ Object
This method turns a pageid into a title.
-
#recent_changes(options = nil) ⇒ Object
Query.
-
#redirect?(title) ⇒ Boolean
Query.
-
#redirects(title, options = nil) ⇒ Object
Query.
-
#revisions(titles, options = nil) ⇒ Object
Prop - Revisions.
-
#site_info(siprop = 'general') ⇒ Object
Meta.
-
#version ⇒ Object
This method will return the version of the MediaWiki server.
-
#watchlist(options = nil) ⇒ Object
Watchlist.
Constructor Details
#initialize(name = "TestBot", username = 'RWikiBot', password = 'rwikibot', domain = 'en', api_path = 'http://localhost:8888/wiki/api.php', wikicookieprefix = 'wikidb_wiki') ⇒ RWikiBot
New bots hope for three attributes, but require none. The first is simply the name of the bot for logging purposes. The second is the debug level constant, and third is the logfile.
Example: bot = RWikiBot.new(“My Neat Bot”, Logger::DEBUG, “./rwikibot.log”)
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/rwikibot.rb', line 29 def initialize ( name = "TestBot", username = 'RWikiBot', password = 'rwikibot', domain = 'en', api_path = 'http://localhost:8888/wiki/api.php', = 'wikidb_wiki') @botname = name @config = Hash.new #We log. Log4r in the house. ##@wikibotlogger = Logger.new('rwikibot.log') #INFO level is nice. I like it as production default because I like log files. Feel free to change. It will change once config loaded ##@wikibotlogger.level = Logger::DEBUG ###@wikibotlogger.info "New RWikiBot created. My name is #{@botname}" # This had to come back since I was having config loading issues when being called from MediaWiki @config['username'] = username @config['password'] = password @config['domain'] = domain @config['api_path'] = api_path @config['wikicookieprefix'] = @config['logged_in'] = FALSE @config['uri'] = URI.parse(@config.fetch('api_path')) ##change - make an HTTP object here for use later, now that we have config @http = Net::HTTP.new(@config.fetch('uri').host, @config.fetch('uri').port) ###@wikibotlogger.debug("INIT - Created HTTP object. Result is: #{@http}}") @config['cookie'] = nil end |
Instance Attribute Details
#botname ⇒ Object
Returns the value of attribute botname.
24 25 26 |
# File 'lib/rwikibot.rb', line 24 def botname @botname end |
#config ⇒ Object
Returns the value of attribute config.
24 25 26 |
# File 'lib/rwikibot.rb', line 24 def config @config end |
#http ⇒ Object
Returns the value of attribute http.
24 25 26 |
# File 'lib/rwikibot.rb', line 24 def http @http end |
Instance Method Details
#all_pages(options = nil) ⇒ Object
List
This will return a list of all pages in a given namespace. It returns a list of pages in with the normalized title and page ID, suitable for usage elsewhere. Accepts all parameters from the API in Hash form. Default is namespace => 0, which is just plain pages. Nothing ‘special’. Also note that if the username the Bot uses is not of type Bot in the Wiki, you will be limited to 50 articles. Also log in, or you get an error.
- INPUT
-
A hash of API-allowed keys and values. Default is same as API default.
- PARAMETERS
-
apfrom (paging), apnamespace (dflt=0), apredirect (flt), aplimit (dflt=10, max=500/5000)
- OUTPUT
-
An array of hashes with information about the pages.
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 |
# File 'lib/rwikibot.rb', line 285 def all_pages ( = nil) # This will get all pages. Limits vary based on user rights of the Bot. Set to bot. ##@wikibotlogger.debug "ALL PAGES - Preparing request information..." post_me = {'list' => 'allpages', 'apnamespace' => '0', 'aplimit' => '5000'} if != nil ##@wikibotlogger.debug("ALL PAGES - Additional options added by requestor. Adding to post_me...") .each_pair do |key, value| post_me[key] = value ##@wikibotlogger.debug "ALL PAGES - Added #{post_me[key]}" end ##@wikibotlogger.debug("ALL PAGES - No more additional options. Moving on...") end #make the request ##@wikibotlogger.debug "ALL PAGES - Asking make_request to get all pages..." allpages_result = make_request('query', post_me) ##@wikibotlogger.debug "ALL PAGES - We should have a result now..." return allpages_result.fetch('allpages') end |
#backlinks(titles, options = nil) ⇒ Object
List
This method fetches any article that links to the article given in ‘title’. Returned in alphabetical order.
- INPUT
-
A normalized article title or titles (pipe delimited), and a hash of API-allowed keys and values. Default is same as API default.
- PARAMETERS
-
blfrom (paging), blnamespace (flt), blredirect (flt), bllimit (dflt=10, max=500/5000)
- OUTPUT
-
An array of hashes with backlinked articles.
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 |
# File 'lib/rwikibot.rb', line 317 def backlinks (titles, = nil) # This will get all pages. Limits vary based on user rights of the Bot. Set to bot. ##@wikibotlogger.debug "BACKLINKS - Preparing request information..." post_me = {'list' => 'backlinks', 'titles' => "#{title}" } if != nil ##@wikibotlogger.debug("BACKLINKS - Additional options added by requestor. Adding to post_me...") .each_pair do |key, value| post_me[key] = value ##@wikibotlogger.debug "BACKLINKS - Added #{post_me[key]}" end ##@wikibotlogger.debug("BACKLINKS - No more additional options. Moving on...") end #make the request ##@wikibotlogger.debug "BACKLINKS - Asking make_request to get backlinks..." backlinks_result = make_request('query', post_me) ##@wikibotlogger.debug "BACKLINKS - We should have a result now..." return backlinks_result.fetch('backlinks') end |
#embedded_in(title, options = nil) ⇒ Object
List
This method pulls any page that includes the template requested. Please note - the template must be the full name, like “Template:Disputed” or “Template:Awesome”. Just one, please.
- INPUT
-
A normalized template title, and a hash of API-allowed keys and values. Default is same as API default.
- PARAMETERS
-
eifrom (paging), einamespace (flt), eiredirect (flt), eilimit (dflt=10, max=500/5000)
- OUTPUT
-
An array of hashes with articles using said template.
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 |
# File 'lib/rwikibot.rb', line 348 def (title, = nil) # This will get all pages. Limits vary based on user rights of the Bot. Set to bot. ##@wikibotlogger.debug "EMBEDDED IN - Preparing request information..." post_me = {'list' => 'embeddedin', 'titles' => "#{title}" } if != nil ##@wikibotlogger.debug("EMBEDDED IN - Additional options added by requestor. Adding to post_me...") .each_pair do |key, value| post_me[key] = value ##@wikibotlogger.debug "EMBEDDED IN - Added #{post_me[key]}" end ##@wikibotlogger.debug("EMBEDDED IN - No more additional options. Moving on...") end #make the request ##@wikibotlogger.debug "EMBEDDED IN - Asking make_request to get backlinks..." = make_request('query', post_me) ##@wikibotlogger.debug "EMBEDDED IN - We should have a result now..." return .fetch('embeddedin') end |
#info(titles) ⇒ Object
Prop = Info
I decided to split this up since I wanted to normalize the bot framework as much as possible, or in other words, make it as easy to use as possible. I think the sacrifice of more methods is worth having more English looking code. Its the Ruby way. Info will return information about the page, from namespace to normalized title, last touched, etc.
- INPUT
-
This method only takes titles, but will accept a pipe-delimited string. Ex: “Apple|Baseball|Horse|Main Page”
- OUTPUT
-
An array of hashes.
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 |
# File 'lib/rwikibot.rb', line 411 def info (titles) # Basic quqery info ##@wikibotlogger.debug "INFO - Preparing the query..." post_me = {"prop" => "info", 'titles' => titles} # Make the request ##@wikibotlogger.debug "INFO - Asking make_request to get info" info_result = make_request('query', post_me) ##@wikibotlogger.debug "INFO - We should have a result set now..." # Result processing ##@wikibotlogger.debug "INFO - Preparing results..." return info_result.fetch('pages') end |
#log_events(options = nil) ⇒ Object
List
This will reutrn a list of the most recent log events. Useful for bots who want to validate log events, or even just a notify bot that checks for events and sends them off.
- INPUT
-
A hash of API-allowed keys and values. Default is same as API default.
- OUTPUT
-
An array of hashes containing log events.
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
# File 'lib/rwikibot.rb', line 163 def log_events ( = nil) ##@wikibotlogger.debug "LOG EVENTS - Preparing request information..." # Make the request post_me = {"list" => "logevents"} if != nil ##@wikibotlogger.debug("LOG EVENTS - Additional options added by requestor. Adding to post_me...") .each_pair do |key, value| post_me[key] = value ##@wikibotlogger.debug "LOG EVENTS - Added #{post_me[key]}" end ##@wikibotlogger.debug("LOG EVENTS - No more additional options. Moving on...") end #Make the request! ##@wikibotlogger.debug "LOG EVENTS = Asking make_request to get logevents" logevents_result = make_request('query', post_me) ##@wikibotlogger.debug "LOG EVENTS - We should have a result of type logevents now." # Process results ##@wikibotlogger.debug "LOG EVENTS - Processing result..." return logevents_result.fetch('logevents') end |
#login ⇒ Object
Login
This is the method that will allow the bot to log in to the wiki. Its not always necessary, but bots need to log in to save changes or retrieve watchlists.
No variables are accepted and the username/password are stored in config.yaml.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/rwikibot.rb', line 63 def login ###@wikibotlogger.debug("LOGIN - Preparing login information...") post_me = {'lgname'=>@config.fetch('username'),'lgpassword'=>@config.fetch('password')} if @config.has_key?('domain') && (@config.fetch('domain') != nil) post_me['lgdomain'] = @config.fetch('domain') end ###@wikibotlogger.debug("LOGIN - Asking make_request to perform login...") login_result = make_request('login', post_me) ##@wikibotlogger.debug("LOGIN - We should have a result of type login now.") ##@wikibotlogger.debug("LOGIN - login_result received. Result is: #{login_result.fetch('result')}") # Now we need to changed some @config stuff, specifically that we're logged in and the variables of that # This will also change the make_request, but I'll comment there if login_result.fetch('result') == "Success" # All lg variables are directly from API and stored in config that way ##@wikibotlogger.info("LOGIN - Login successful. Wiki user is: #{login_result.fetch('lgusername')}") @config['logged_in'] = TRUE @config['lgusername'] = login_result.fetch('lgusername') @config['lguserid'] = login_result.fetch('lguserid') @config['lgtoken'] = login_result.fetch('lgtoken') ##@wikibotlogger.debug("LOGIN - MediwWiki API variables stored in @config") return TRUE else ##@wikibotlogger.error("LOGIN - Login Error. Wiki API said: #{login_result.fetch('result')}") return FALSE end end |
#make_unique(array) ⇒ Object
The point of this method is to iterate through an array of hashes, which most of the other methods return, and remove multiple instances of the same wiki page. We’re more than often only concerned with the most recent revision, so we’ll delete old ones.
Hashes don’t respond to the the Array.uniq method. So this is the same-ish
- INPUT
-
An array of hashes.
- OUTPUT
-
An array of hashes that are unique.
504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 |
# File 'lib/rwikibot.rb', line 504 def make_unique(array) test_array = array count = 0 # First, let's make one big loop to go through each item in the array. array.reverse.each do |current_item| # Now, let's loop double time. test_array.each do |test_item| # Some comparisons... if (current_item.fetch('title') == test_item.fetch('title') && current_item.fetch('revid') > test_item.fetch('revid') ) # At this point, current is the same article as test, and current is newer. Delete test array.delete(test_item) count += 1 end end end puts "Deleted #{count} items." return array end |
#normalize(title) ⇒ Object
Query
This little ditty returns a normalized version of the title passed to it. It is super useful because it will normalize an otherise poorly entered title, but most importantly it will let us know if an article exists or not by if it is able to normalize.
- INPUT
-
Titles, either singular or pipe-delimited.
- OUTPUT
-
An array of normalized hashes.
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
# File 'lib/rwikibot.rb', line 258 def normalize (title) # Prepare the request ##@wikibotlogger.debug "NORMALIZE - Preparing request information..." post_me = {'titles' => title} #Make the request ##@wikibotlogger.debug "NORMALIZE - Asking make_request to normalize titles..." normalized_result = make_request('query', post_me) ##@wikibotlogger.debug "NORMALIZE - We should have a result now..." ##@wikibotlogger.debug "NORMALIZE - Processing result..." return normalized_result.fetch('pages') end |
#page_exists?(title) ⇒ Boolean
This is a little something I cooked up because it seems like a totally logical thing for bots to want to do. Basically, you feed it a page title - any you want (that’s the point) - and it returns TRUE or FALSE if the page exists inside the wiki. Technically, it pulls an attribute “missing”, and in its presense, reports TRUE since the page is fake. That’s something a bot would want to do, right?
- INPUT
-
A title. Just one!
- OUTPUT
-
TRUE/FALSE, depending on which is correct
537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 |
# File 'lib/rwikibot.rb', line 537 def page_exists? (title) # Prepare the request ##@wikibotlogger.debug "PAGE EXISTS? - Preparing request information..." post_me = {'titles' => title} #Make the request ##@wikibotlogger.debug "PAGE EXISTS? - Asking make_request to verify page existence..." page_exists_result = make_request('query', post_me) ##@wikibotlogger.debug "PAGE EXISTS? - We should have a result now..." ##@wikibotlogger.debug "PAGE EXISTS? - Processing result..." if page_exists_result.fetch('pages')[0].has_key?('missing') ##@wikibotlogger.debug "PAGE EXISTS? - The page #{title} does NOT exist. Sorry." return false else ##@wikibotlogger.debug "PAGE EXISTS? - The page #{title} DOES exist. You lucky, lucky bot." return true end end |
#pageid_to_title(id) ⇒ Object
This method turns a pageid into a title. Why? Because I’ve written the rest of the methods title-centric, and I want to keep it that way. But, sometiumes you get a list of ids and not titles, and we have to do something about that.
- INPUT
-
PageID - just one!
- OUTPUT
-
A title in string form.
575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 |
# File 'lib/rwikibot.rb', line 575 def pageid_to_title(id) # Prepare the request! Notify the logger! ##@wikibotlogger.debug "PAGEID TO TITLE - Preparing the requeset..." post_me = {'prop' => 'info', 'pageids' => id} # Make the request. Becuase we care. ##@wikibotlogger.debug "PAGEID TO TITLE - Asking make_request to get revision for pageid #{id}" id_result = make_request('query', post_me ) ##@wikibotlogger.debug "PAGEID TO TITLE - We should have a result now..." #Process the results ##@wikibotlogger.debug "PAGEID TO TITLE - Preparing results..." return id_result.fetch('pages')[0].fetch('title') end |
#recent_changes(options = nil) ⇒ Object
Query
This method will return Wiki-wide recent changes, almost as if looking at the Special page Recent Changes. But, in this format, a bot can handle it. Also we’re using the API. And bots can’t read.
- INPUT
-
A hash of API-allowed keys and values. Default is same as API default.
- PARAMETERS
-
letype (flt), lefrom (paging timestamp), leto (flt), ledirection (dflt=older), leuser (flt), letitle (flt), lelimit (dflt=10, max=500/5000)
- OUTPUT
-
An array of hashes.
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/rwikibot.rb', line 131 def recent_changes (=nil) # This will allow any given bot to get recent changes. Then act on it. But that's another method # TODO - Persistent timestamp storage ##@wikibotlogger.debug("RECENT CHANGES - Preparing request information...") post_me = {"list" => "recentchanges", 'rclimit' => '5000'} if != nil .each do |key, value| post_me[key] = value end end # Make the request ##@wikibotlogger.debug "RECENT CHANGES - Asking make_request to get recentchanges..." recentchanges_result = make_request('query' , post_me) ##@wikibotlogger.debug "RECENT CHANGES - We should have a result of type query now." # Figure out what to do now. Process, I'd think ##@wikibotlogger.debug "RECENT CHANGES - Processing result..." return recentchanges_result.fetch('recentchanges') end |
#redirect?(title) ⇒ Boolean
Query
This is a lot like REDIRECTS method, except its just a true/false to validate whether or not an article is a redirect. We could write the logic into the final bot app, but we’re awesome and we include a quicky method.
- INPUT
-
Title (please, just one!)
- OUTPUT
-
True/False
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'lib/rwikibot.rb', line 232 def redirect? (title) # Prepare the request ##@wikibotlogger.debug "REDIRECT? - Preparing request information..." post_me = {'titles' => title, 'redirects'=>'', 'prop' => 'info'} #Make the request ##@wikibotlogger.debug "REDIRECT? - Asking make_request find redirects..." redirects_result = make_request('query', post_me) ##@wikibotlogger.debug "REDIRECT? - We should have a result now..." ##@wikibotlogger.debug "REDIRECT? - Processing result..." return redirects_result.has_key?('redirects') end |
#redirects(title, options = nil) ⇒ Object
Query
This will return any redirects from an article title so that you know where it ends. Useful to check for redirects, but mostly here for completeness of the framework.
- INPUT
-
A string of pipe-delimited titles (‘Apple|Baseball|Car port’), and an optional hash of API acceptable values.
- OUTPUT
-
An array of redirects.
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/rwikibot.rb', line 198 def redirects (title, = nil) # Prepare the request ##@wikibotlogger.debug "REDIRECTS - Preparing request information..." post_me = {'titles' => title, 'redirects'=>'', 'prop' => 'info'} if != nil ##@wikibotlogger.debug("REDIRECTS - Additional options added by requestor. Adding to post_me...") .each_pair do |key, value| post_me[key] = value ##@wikibotlogger.debug "REDIRECTS - Added #{post_me[key]}" end ##@wikibotlogger.debug("REDIRECTS - No more additional options. Moving on...") end #Make the request ##@wikibotlogger.debug "REDIRECTS - Asking make_request find redirects..." redirects_result = make_request('query', post_me) ##@wikibotlogger.debug "REDIRECTS - We should have a result now..." ##@wikibotlogger.debug "REDIRECTS - Processing result..." return redirects_result.fetch('pages') end |
#revisions(titles, options = nil) ⇒ Object
Prop - Revisions
This is the main way of accessing content and page specific information from the wiki. It has multiple uses as described in the API, Its also considerably more complex than the other methods. Enjoy it. A final note - I’d really be familiar with this method in the API since I’ve spent a lot of time trying to figure it out myself.
Please be sure to add the RVPROP key at least, otherwise you’ll just get the basic information of revid, oldid and pageid. Boring.
- INPUT
-
A string of article titles (pipe-delimited), and a hash of API-allowed keys and values. Default is same as API default.
- OUTPUT
-
An array of hashes.
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 |
# File 'lib/rwikibot.rb', line 439 def revisions(titles, = nil) # Prepare the request! Notify the logger! ##@wikibotlogger.debug "REVISIONS - Preparing the requeset..." post_me = {'prop' => 'revisions', 'titles' => titles} # Handle any additional options if != nil ##@wikibotlogger.debug("REVISIONS - Additional options added by requestor. Adding to post_me...") .each_pair do |key, value| post_me[key] = value ##@wikibotlogger.debug "REVISIONS - Added #{post_me[key]}" end ##@wikibotlogger.debug("REVISIONS - No more additional options. Moving on...") end # Make the request. Becuase we care. ##@wikibotlogger.debug "REVISIONS - Asking make_request to get revision for articles(s) #{titles}" revisions_result = make_request('query', post_me ) ##@wikibotlogger.debug "REVISIONS - We should have a result now..." #Process the results ##@wikibotlogger.debug "REVISIONS - Preparing results..." return revisions_result.fetch('pages') end |
#site_info(siprop = 'general') ⇒ Object
Meta
This is the only meta method. It will return site information. I chose not to allow it to specify, and it will only return all known properties. api.php?action=query&meta=siteinfo&siprop=general|namespaces
- INPUT
-
siprop is either ‘general’ or ‘namespaces’.
- OUTPUT
-
A hash of values about site information.
475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 |
# File 'lib/rwikibot.rb', line 475 def site_info (siprop = 'general') ##@wikibotlogger.debug "SITE INFO - Preparing request information..." # Make the request post_me = {"meta" => "siteinfo" , "siprop" => siprop} #Make the request! ##@wikibotlogger.debug "SITE INFO - Asking make_request to get site info" siteinfo_result = make_request('query', post_me) ##@wikibotlogger.debug "SITE INFO - We should have a result of type site info now." # Process results ##@wikibotlogger.debug "SITE INFO - Processing result..." if siprop == 'general' return siteinfo_result.fetch('general') else return siteinfo_result.fetch('namespaces') end end |
#version ⇒ Object
This method will return the version of the MediaWiki server. This is done by parsing the version number from the generator attribute of the the site_info method. Useful? Yes - maybe yout bot is only compatible with MediaWiki 1.9.0 depending on what methods you use. I like it, anwyay.
- INPUT
-
None
- OUTPUT
-
Version number
566 567 568 569 |
# File 'lib/rwikibot.rb', line 566 def version # Almost TOO simple... return site_info.fetch('generator').split(' ')[1] end |
#watchlist(options = nil) ⇒ Object
Watchlist
This method will get the watchlist for the bot’s MediaWiki username. This is really onlu useful if you want the bot to watch a specific list of pages, and would require the bot maintainer to login to the wiki as the bot to set the watchlist.
- INPUT
-
Options is a hash of API allowed fields that will be passed.
- OUTPUT
-
Returns an array of hashes.
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/rwikibot.rb', line 102 def watchlist (=nil) # Get the bot's watchlist ##@wikibotlogger.debug("WATCHLIST - Preparing request information...") post_me = {'list'=>'watchlist'} if != nil .each do |key, value| post_me[key] = value end end # Make the request ##@wikibotlogger.debug "WATCHLIST - Asking make_request to get watchlist..." watchlist_result = make_request('query', post_me) ##@wikibotlogger.debug "WATCHLIST - We should have a result of type query now." #Process into a Hash for return ##@wikibotlogger.debug "WATCHLIST - Processing result..." return watchlist_result.fetch('watchlist') end |