Closed ghost closed 5 years ago
Hi, are you seeing any error messages?
Just to be sure we're on the same page, if you're running this bot on glitch.com, which puts apps to sleep after 5 minutes of no traffic, you need to set up a service that wakes up your bot.
See https://github.com/fourtonfish/random-image-twitterbot/blob/master/server.js#L71
I do not see any error messages and I run the bot on my own machine. As shown in the below, the bot does everything right, but it stops running afterwards.
$ node server-delete-images.js
Reading image directory... Opening an image... Uploading an image... Image uploaded! Now tweeting it... Posted an image! Now deleting... image /home/marina/twitterbot/images/the_last_of_us_1313.jpg was deleted
PS: When I run the bot using the server.js file, it does everything right as well, but keeps posting from time to time without interrupting execution. Only the server-delete-images.js bot that does not continue posting when sending and deleting the image.
This bot needs for use along with cron?
Thanks for replying!
Using cron might be best, because you can easily control how often the bot posts.
You could use an interval, but you'd need something like to pm2 keep the app running, and if your app stops for some reason, it will restart the interval.
Or maybe a cron node.js package, like this one, would be a good solution, but you'd still need to use pm2.
I updated the file to include the setInterval
example.
Before I see this update, I tested it with this here. Curiously, I was able to do what I wanted using this version.
And I copied that excerpt var T = new Twit(config.twitter);
from the server.js file, because I noticed it was different and had not worked.
I thank you anyway.
Sure, no problem. And thank you, I fixed it!
Hi, I'm trying to use this bot to post some images on twitter. But for some reason, every time it sends the image and deletes it, the bot interrupts its operation. Is there any way to keep it working?
Thanks!