RE: [ENG/ITA] Python and Hive: My First Attempt with a Bot

You are viewing a single comment's thread:

First of all:

if "parent_author" not in op.keys():
continue

op.keys() is a list, and here you're checking if this key exists in the list, to determine if op is a comment or a post, but,the "parent_author" key will always be in the list, so you should check:

if op.get("parent_author") == "":
continue

Then, I would change the order of the checks: first, check if it's a comment, then if it's an authorized caller account, and finally if a command exists in the body.



0
0
0.000

1 comments

Understood, thanks for your suggestions and corrections :)

That check was in the original code and I left it only because I thought it was meant to catch some bugs, as there was a comment before that check saying "do exist posts without author!?"... but now I'm going to change it as you suggested, so it would work properly.

0
0
0.000