The Previous Update Broke Our Bot And I Don't Know Why

Hi all, I’m not sure where I should post.

The mod team at mma@kbin.social uses this account to run a bot found here: github.com/daniel-lxs/BotIt

What this bot does, it is uses karma criteria on reddit, to grab the links of the best breaking news in the MMA world and automatically post it on here.

It allows our users to catch all the breaking news without having to use Reddit.

We are now getting an incorrect_login error. The previous bot maker is MIA and has left the project.

We lost almost all of our users the last time lemmy prevented this account from posting in some kind of bot purge or something. We got posting privileges back awhile back, but now we are afraid we are going to lose the rest of our users.

Having the bot being able to post breaking news is absolutely crucial for us. Can anyone help?

BakedCatboy,

Just a shot in the dark but I’ve seen some people say something about one of the updates logging out accounts as a security measure. Assuming the recent updates didn’t change auth stuff, maybe it’s possible that it just needs to refresh the token? A glance at the code looks like it will keep trying to use the same JWT as long as it’s still valid, and fall back to getting a new JWT using username/password. So deleting the JWT would make it get a new one. (Iirc JWTs have an embedded expiration, but the server can invalidate it so the bot code could in theory not know that the server can invalidate it)

Assuming you’re getting the incorrect login error from Lemmy. Idk maybe I’m way off base with my guess.

MMARefugee,

Thank you for responding.

[ERROR] [LEMMY] Error while trying to login, host might be down

[ERROR] [SCHEDULER] An error occurred: Error: incorrect_login

Is the error.

I have attempted to add a different username and password and it didn’t work. Would that get a new JWT?

If not how do I delete it?

BakedCatboy,

Hmm maybe it’s not that simple then. It doesn’t look like the JWT is stored so it’s probably trying to get a new one when started. The other possible culprit would be if you need to use lemmy-js-library with a major version matching the Lemmy server version.

Assuming the server updated to 0.19.0, the version used by the bot is 0.18.0. You would just need to edit package.json so that the lemmy-js-client line reads:

“lemmy-js-client”: “^0.19.0”,

Then running npm install or yarn install (or whatever command you used to install dependencies previously)

MMARefugee, (edited )

After suggested change:

PS C:\Users***********\Botlt> npm install

npm ERR! code EJSONPARSE

npm ERR! path C:\Users********\Botlt/package.json

npm ERR! JSON.parse Unexpected token ““” (0x201C) in JSON at position 976 while parsing near “… "lemmy-js-client": “^0.19.0”,\r\n "lin…”

npm ERR! JSON.parse Failed to parse JSON data.

npm ERR! JSON.parse Note: package.json must be actual JSON, not just JavaScript.


I went back in and changed it to:


<span style="color:#323232;">"lemmy-js-client": "^0.19.0-rc.1",
</span>

It will now run again, but same incorrect_login error.

BakedCatboy,

I think that’s part of the solution, I skimmed some of the forks and found one that updated the lemmy-js-client to 0.19.2-alpha.3 but they made some code changes too to the authentication code. So maybe trying that fork is worth a shot: github.com/thepaperpilot/BotIt

Last changes were last month on that fork

MMARefugee,

Thanks so much for your help.

I am not programmer, and I didn’t even realize there was a fork. Let me root around in there and see what I can find out tomorrow.

Thanks again.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • support@lemmy.world
  • DreamBathrooms
  • magazineikmin
  • everett
  • InstantRegret
  • rosin
  • Youngstown
  • slotface
  • love
  • khanakhh
  • kavyap
  • tacticalgear
  • GTA5RPClips
  • thenastyranch
  • modclub
  • megavids
  • mdbf
  • normalnudes
  • Durango
  • ethstaker
  • osvaldo12
  • cubers
  • ngwrru68w68
  • tester
  • anitta
  • cisconetworking
  • Leos
  • provamag3
  • JUstTest
  • All magazines