Zokalyx / theconfluence

1 stars 2 forks source link

Bot pins posts incorrectly #11

Open Zokalyx opened 2 years ago

Zokalyx commented 2 years ago

Sometimes the bot wrongfully pins posts on its profile. What it should do is have the FAQ post always pinned, and the summary post of the current run pinned. The cause has not been identified - it may or not be inside of the code.

Tests are needed to reproduce the issue. Code looks correct (?):

    # Remove duplicates
    posts = profile.new(limit=10)
    for post in posts:
        if f"Run {run}" in post.title:
            post.delete()
        elif post.stickied and "summary" in post.title:
            post.mod.sticky(False)  # <----------------------------------------

    # Unpin FAQ
    faq.mod.sticky(False)  # <-------------------------------------------------

    # Post
    profile.submit(f"Run {run} arrivals", d_arr)
    profile.submit(f"Run {run} flairs", d_dep)
    to_pin = profile.submit(f"Run {run} summary - {ret}% retention", summary)

    # Pin FAQ and summary
    faq.mod.sticky(True)  # <--------------------------------------------------
    to_pin.mod.sticky(True)  # <-----------------------------------------------

I will check in weekly with how the bot did. It may have been me doing something weird in the account or straight up tripping, we'll see.

Zokalyx commented 2 years ago

New bot will not touch the FAQ post. Order may not be desired but it's just simpler. See InboxHandler.py.