Wiktionary talk:Votes/bt-2009-03/User:HersfoldBot for bot status

From Wiktionary, the free dictionary
Jump to navigation Jump to search

case[edit]

"Do not already exist here in either the Transwiki: or main word namespaces" — WP articles' titles are all first-letter capital. Will the bot check for the corresponding lowercase page here?—msh210 15:34, 19 March 2009 (UTC)[reply]

Yes; the relevant part of the source code is:
	private boolean articleExistsOnWikt(String article){
		if(!fatalErrorExists()){
			try{
				// This next line checks for [[Transwiki:Article]] and [[article]] - both must not exist for the bot to import
				return wiktionary.exists("Transwiki:"+article)[0] || wiktionary.exists(article.toLowerCase())[0];
			}
			catch(IOException e){
				System.err.println(e.getMessage());
				exitCode = -2;
			}
		}
		return false;
	}
If either page exists, the bot will not import the article but will mark it as already imported on our (Wikipedia's) end. Hersfold (talk) 17:14, 23 March 2009 (UTC)[reply]
That's not very complete. :-/   Before Transwiki-ing w:United States of America, I think you should check for all of the following here:
BTW, Wiki#exists(String...) performs just one API query, so it's friendlier to call it once with four arguments than four times each with one argument.
RuakhTALK 21:47, 23 March 2009 (UTC)[reply]
Hm. Good point. Ok, I'll make some revisions and update the code. Thanks! Hersfold (talk) 04:02, 24 March 2009 (UTC)[reply]
Now updated to catch all four cases you outlined:
try{
	String articleLower = article.toLowerCase();
	String articleFirstLower = article.substring(0,1).toLowerCase() + article.substring(1);
	boolean[] exists = wiktionary.exists("Transwiki:"+article, article, articleLower, articleFirstLower);
	return exists[0] || exists [1] || exists [2] || exists [3];
}
Thanks, gentlemen.—msh210 17:10, 24 March 2009 (UTC)[reply]

bot flag[edit]

The proposal says the bot won't need the bot flag. Why? Is that because the imports won't show up on recentchanges?—msh210 15:41, 19 March 2009 (UTC)[reply]

The imports may show up there anyway (not 100% sure on that), but the edits it makes to WT:TW, for example, would certainly not appear in RC unless the bot is unflagged as I am requesting. Also, the bot has no need for the higher editing rate limits as it is not intended to run very quickly (it's set to the default throttle speed of about 5-10 seconds/edit so that it a) doesn't kill the import API which I'm told is shaky to begin with (and testing confirms this) and b) I have time to notice and can kill the bot in the unlikely event something goes wrong and it doesn't kill itself. Any user can write to the API, so the bot does not need the flag for that particular thing to work; it just needs the import flag so it has the right to use that particular function. I hope this answers your question. Hersfold (talk) 17:06, 23 March 2009 (UTC)[reply]