Java/Kotlin Wiki Bot Framework

Java/Kotlin Wiki Bot Framework

4 devlogs
3h 46m
Created by aaronliu

An actually object-oriented Java API for interacting with MediaWiki! ... last updated in 2019. I forked it, and will try to get it back up and running and then port it to Kotlin.

test it out with `mvn test`!!

(AI used for banner image, that doesn't mean AI helped code/dependency manage right?)

Timeline

In this edition of the devlog, we proudly present a marvelous guest speaker: MYSELLLF!!!! through the commit message!!! which doubles as part of this devlog y'know why write twice when you can write thrice and invest meaningless time writing devlogs about writing devlogs hey hello how are you doing

With that, all of the tests now succeed.

Four skip, though.

Next up is fixing what was broken by https://www.mediawiki.org/wiki/MediaWiki_1.37/Deprecation_of_legacy_API_token_parameters . That should make me our final Java (euuuugh) release, after which I'll port this to glorious Kotlin.

Onwards!

Update attachment

It looks like the project's previous archaic version of Apache HttpClient simply did not realize this is an invalid hostname. The test silently failed to seem like a success.

This is a genius idea I'll be sure to remember in my future days as a wage slave!

Update attachment
Earned sticker

The answer was stupidly simple: the parallel testing another PR recommended caused it! Who knew monothreaded listeners would fail when you run multiple of them at once??

That cleared up a ton of errors, especially after I discovered and fixed the jackson.databind.PropertyNamingStrategy import being pluralized on the way.

Now, I'm discovering a something seemingly utterly insane: a built-in test (triggerable outside the test suite through a simple constructor parameter) passing an invalid parameter value! What could've wrought this monstrosity‽

Update attachment

Ship 1

aaronliu

about 1 year ago

aaronliu • Covers 1 devlog and 2h 38m

I wanted to make a bot to perform a very specific task on the English Wikipedia. Because Kotlin is THE GlanguageOAT, I browsed https://www.mediawiki.org/wiki/Manual:Creating_a_bot#Java , concluding that only JWBF had a sane (read object-oriented) API. Look, why'd you make something for Java if it isn't object-fracking-oreinted? What in the name of God and all that is holy is bot.edit("Attempted assassination of Gerald Ford in San Francisco", "A very long string representing the changed full text of the article about how Oliver Sipple saved the President's life by tackling assassin Sara Jane Moore's gun and was promptly outed as gay\n==Biography==\n==History==\n==Background==\n==Legacy==\n==Reception==\n{{citation...", "my awesome, correct edit message");" instead ofarticle = bot.getArticle(Attempted assassination of Gerald Ford in San Francisco); article.setText(blabhlabhalbjkdflhabljugetthepoint); /* which becomes just article.text = something in Kotlin! */ article.setEditSummary(my awesome, correct edit summary); article.save();`? You're editing the article, not the bot! Witness the unlimited power of the greatest sexual orientation ever!

    ContentAccessable ca =
        new ContentAccessable() {

          @Override
          public boolean isMinorEdit() {
            return Math.random() > 0.5 ? true : false;
          }

          @Override
          public String getText() {
            return "test";
          }

          @Override
          public String getTitle() {
            return "MyTest";
          }

          @Override
          public String getEditor() {
            return OtherClass.getLocalizedProfileName();
          }

          @Override
          public String getEditSummary() {
            return null;
          }
        };

    SimpleArticle sa = new SimpleArticle(ca);
    Article article = new Article(bot, sa);
    sa.save();

🥹 the possibilities are limitless

it's just that the language is convenienceless.

and my problems will prove to not just stop at the language...

So, let's look at the state of the project: holy heck look at all those depbump PRs

naturally, I gravitated to overexerting myself trying to do all t hem myself, but there's all kinds of incompatibilities even after openrewrite and 2.5h of shuffling around maven dependency hell!

at least all i have to fix are test mockito listeners now...

conclusion:

🫠 the hassle is limitless

Update attachment
aaronliu aaronliu about 1 year ago

Though the tests don’t work, I feel like the project task of updating the dependencies to non-vulnerable versions was completed, as running the tests manually using example code seems to work just fine and allowed my bot application to run.