Просмотр исходного кода

make tootbot even more verbose

master
Andreas Demmelbauer 6 лет назад
Родитель
Сommit
586614bdd3
1 измененных файлов: 11 добавлений и 4 удалений
  1. +11
    -4
      tootbot.py

+ 11
- 4
tootbot.py Просмотреть файл

@@ -98,7 +98,7 @@ for p in reversed(t.entries):
# process only unprocessed tweets less than n days old
if datetime.now() - posttime > timedelta(days=days):
shouldpost = False
print("skip: Post too old")
print("skip: Tweet older than %s days" % days)
# kill tweets with fb links with fire!
if "https://www.facebook.com" in p.title or "https://m.facebook.com" in p.title:
shouldpost = False
@@ -180,9 +180,16 @@ for p in reversed(s.entries):
)
last = db.fetchone()

# process only unprocessed post less than n days old
posttime = datetime(p.published_parsed.tm_year, p.published_parsed.tm_mon, p.published_parsed.tm_mday, p.published_parsed.tm_hour, p.published_parsed.tm_min, p.published_parsed.tm_sec)
if last is None and (datetime.now() - posttime < timedelta(days=days)):

if last is not None:
shouldpost = False
print("skip: already posted")
# process only unprocessed tweets less than n days old
if datetime.now() - posttime > timedelta(days=days):
shouldpost = False
print("skip: Posting older than %s days" % days)

if shouldpost:
# Create application if it does not exist
mastodon_api = register_app(mastuser, mastpasswd, mastinstance, mastodon_api)



Загрузка…
Отмена
Сохранить