Open nemobis opened 2 years ago
Hmm yeah, I see how can be annoying when setting up multiple users for the first time.
I'm trying to think what would be an elegant solution in this usecase, maybe passing the date value directly to the command would be preferable?
Right now the forceDate value can be one of the twitter_username
listed on your config so you force it just for that user, but we could evaluate the value in case it doesn't match any user and you pass a date instead.
So, it would look like along the lines of this, force it just for one user (current behaviour):
$ pleroma-bot --forceDate WoolieWoolz
Or, force a specific date for all users in your config:
$ pleroma-bot --forceDate 2020-12-01
If the date is present, it would be used to gather tweets from that date onwards, without asking for any input.
Would that work for you?
Thank you for your thoughtful reply.
Il 03/04/22 17:33, robertoszek ha scritto:
If the date is present, it would be used to gather tweets from that date onwards, without asking for any input.
Yes, this would be intuitive for me. Indeed that's how I thought this flag already worked: I was running
pleroma-bot --forceDate 2022-04-03
No idea why I misunderstood the documentation this way, maybe just wishful thinking.
I also included this change in 1.0.3rc8, feel free to give it a try:
pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple pleroma-bot==1.0.3rc8
It should work as you expected before (with the date format being YYYY-MM-DD):
$ pleroma-bot --forceDate 2020-12-01
Thank you! However I may have misunderstood what you meant: I see that duplicate toots are posted as the forced date takes precedence over the last toot, so I can't use that option twice for the same user.
What I really want is perhaps to override this in the force_date() function:
if input_date == "continue":
if self.posts != "none_found":
date = self.get_date_last_post()
else:
date = datetime.strftime(
datetime.now() - timedelta(days=2), "%Y-%m-%dT%H:%M:%SZ"
)
I'd like to be able to pass a command line flag which will automatically select "continue", and maybe configure the timedelta.
forceDate doesn't seem to take a username now, it wants something in the date format
@realkinetix which version are you on? I'm trying to replicate it to no avail.
It expects the twitter_username
and it will only ask the date for the user matching that twitter_username
on your config.
Perhaps it led to confusion that the other users will complain about it?
For example:
pleroma-bot --forceDate twitterUsername
ℹ 2022-12-19 20:30:41,805 - pleroma_bot - INFO - config path: config-test.yml
ℹ 2022-12-19 20:30:41,805 - pleroma_bot - INFO - tweets temp folder: /home/test/pleroma-bot/tweets
ℹ 2022-12-19 20:30:41,816 - pleroma_bot - INFO - ======================================
ℹ 2022-12-19 20:30:41,816 - pleroma_bot - INFO - Processing user: test_pleroma
✖ 2022-12-19 20:30:45,238 - pleroma_bot - ERROR - Exception occurred for user, skipping... (cli.py:711)
Traceback (most recent call last):
File "/mnt/c/Users/chamorr1/Documents/git/pleroma-bot/pleroma_bot/cli.py", line 572, in main
raise Exception(
Exception: Invalid forceDate format, use "YYYY-mm-dd"
ℹ 2022-12-19 20:30:45,241 - pleroma_bot - INFO - ======================================
ℹ 2022-12-19 20:30:45,241 - pleroma_bot - INFO - Processing user: 109452890846928419
ℹ 2022-12-19 20:30:47,360 - pleroma_bot - INFO - How far back should we retrieve tweets from the Twitter account?
ℹ 2022-12-19 20:30:47,361 - pleroma_bot - INFO -
Enter a date (YYYY-MM-DD):
[Leave it empty to retrieve *ALL* tweets or enter 'continue'
if you want the bot to execute as normal (checking date of
last post in the Fediverse account)]
For a config such as this one:
[...]
users:
- twitter_username: github
pleroma_username: test_pleroma
pleroma_token: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
- twitter_username: twitterUsername
pleroma_username: 109452890846928419
pleroma_token: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Hmm. I've apparently fooled around enough with the version I'm using to have broken the breakage I was seeing. My apologies for not posting the version and output at the time. I am seeing 1.1.1rc1 via pip and 1.1.0 (from git master branch) behaving pretty much as you've shown.
I have to populate a number of accounts for the first time, so it's annoying to have to require manual input like this:
Am I supposed to use --forceDate together with --skipChecks the first time? Currently I'm using a silly patch like this in _utils.py after
logger.info(date_msg)
:I don't quite understand what cli.py is trying to do here:
It feels like
date_pleroma
is never set to args.forceDate.