Closed samuk closed 1 year ago
Looks like an issue with getting the instance name filled in properly when the bot tries to log in. If you go into main.js and replace process.env.INSTANCE with the instance name in quotation marks (e.g. "programming.dev") does it work / give you a different error? Dont know for sure how you formatted your .env file but this should see if thats the issue (it probably will throw a similar one for the username or password)
Thanks. That does give a new error node main.js STARTED: Started Bot INSTANCES: 1 instances loaded. FEEDS: 1 feeds loaded. Starting bot Initializing DB logging in DB: Connected to the database. TABLE: Loaded posts table. POSTS: 0 posts in database. TABLE: Loaded time table
/home/sam/Downloads/Lemmy-Mega-Bot-main/node_modules/node-fetch/lib/index.js:273
return Body.Promise.reject(new FetchError(invalid json response body at ${_this2.url} reason: ${err.message}
, 'invalid-json'));
^
FetchError: invalid json response body at https://lemmy.world/api/v3/user/login reason: Unexpected token J in JSON at position 0
at /home/sam/Downloads/Lemmy-Mega-Bot-main/node_modules/node-fetch/lib/index.js:273:32
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
type: 'invalid-json'
}
Node.js v18.13.0
That one is an error thrown by the lemmy api itself that ive been running into a well. It might fix if you keep trying to run it or if you havent already replace process.env.USERNAME and process.env.PASSWORD with your username and password respectively
Its just something that im currently waiting on the people managing the api to fix though
Great thanks. I'll close this as the initial issue is resolved. I'll try a few more times. I know lemmy.world has been having DDOS attacks so I wonder if it's related to that?
That gets me logged in OK. This is where I'm trying to post https://lemmy.world/c/climate@kbin.social I can't get the syntax correct.
:~/Downloads/Lemmy-Mega-Bot-main$ node main.js STARTED: Started Bot INSTANCES: 1 instances loaded. FEEDS: 1 feeds loaded. Starting bot Initializing DB logging in DB: Connected to the database. TABLE: Loaded posts table. POSTS: 0 posts in database. TABLE: Loaded time table logged in Could not get !climate@kbin.social@lemmy.world
How are you trying to post to it? Youll want to follow the format I set up in the yaml file (and not touch any files other than that)
In the yaml file you tend to want to format it like
instances:
kbin.social:
climate:
- "rssfeedname"
Edit since I found a lemmy.world bot posting to kbin so redacting my different platform statement
Is there a way to limit the URLs fetched in a single run? I'd be happy with just one per run.
Sometimes run into [UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "rate_limit_error".] { code: 'ERR_UNHANDLED_REJECTION' }
Google news also seem to do weird stuff to a feed: https://lemmy.world/post/1620328 I'll try and work it out myself, but do let me know if it's obvious to you what I need to change to resolve the actual link.
Theres not currently a way to limit the URLS but if thats being thrown when youre creating comments you can adjust the sleepDuration variable in main. Ill add that in real quick though
And yeah some rss feeds do some funky stuff in some of the parts. Dont think it provides the actual link anywhere. For getting the html tags out I can push out an update to handle that
I just pushed some changes to the bot that should fix most things. Let me know if something still doesnt work
Have I put something stupid in .env?
~/Downloads/Lemmy-Mega-Bot-main$ node main.js STARTED: Started Bot INSTANCES: 1 instances loaded. FEEDS: 1 feeds loaded. /home/sam/Downloads/Lemmy-Mega-Bot-main/node_modules/lemmy-bot/dist/helpers.js:36 const stripPort = (instance) => instance.replace(/:.*/, ''); ^
TypeError: Cannot read properties of undefined (reading 'replace') at stripPort (/home/sam/Downloads/Lemmy-Mega-Bot-main/node_modules/lemmy-bot/dist/helpers.js:36:42) at /home/sam/Downloads/Lemmy-Mega-Bot-main/node_modules/lemmy-bot/dist/bot.js:336:141 at Array.some ()
at new LemmyBot (/home/sam/Downloads/Lemmy-Mega-Bot-main/node_modules/lemmy-bot/dist/bot.js:336:99)
at file:///home/sam/Downloads/Lemmy-Mega-Bot-main/main.js:97:13
at ModuleJob.run (node:internal/modules/esm/module_job:194:25)
Node.js v18.13.0