Basis for a comment upvote bot

Sorry, I have been out for a while, and this one isn't bee themed as I am really digging the Borg theme at the moment. But I present to you:

A comment upvote bot

This bot was created because my simple monitor bot seemed to be the most popular article so far. Source can be found at GitHub If you have other things you would like me to attempt please, ask away!

#!/usr/bin/env python3

import os
import re

from beem import Hive
from beem.account import Account
from beem.blockchain import Blockchain
from beem.comment import Comment
from beem.instance import set_shared_blockchain_instance
from beem.utils import construct_authorperm

posting_key = os.environ["BOT"]
REGEX = '(?<=^|(?<=[^a-zA-Z0-9-_\.]))@([A-Za-z]+[A-Za-z0-9]+)'
botname = "thecrazygm"
weight = 100

hive = Hive(node=[''], keys=posting_key)
chain = Blockchain()
followees = Account(botname).get_following()

def summon_upvotebot():
    print(f'[Starting up]')
    while True:
            for post in"comment", threading=True, thread_num=5):
                mentions = re.findall(REGEX, post["body"])
                comment = Comment(post)
                perm = comment.authorperm
                parent = construct_authorperm(
                    Comment(perm).parent_author, Comment(perm).parent_permlink)
                author = post['author']
                if Comment(perm).is_comment:
                    if botname in mentions:
                            f'[{author} just mentioned {botname} in {perm} in reply to {parent}]')
                        if author in followees:
                                weight=weight, voter=botname)
                                f'[{botname} voted {weight}% on {parent} per {author}\'s request]')
                                f'[{author} tried to summon {botname} but is not in the whitelist]')
        except Exception as error:

if __name__ == '__main__':

Now this takes in consideration that you have an env variable called BOT set to your posting key e.g. export BOT=mypostingkeygoeshere from the Linux/Mac cli (not even sure how this is done in Windows, someone care to share?)

This is a comment bot, looking for your bot name in a comment to upvote the parent comment and only if that person is in the bot's following list. This was done for two reasons:

  1. to create a simple 'whitelist'
  2. to show some of the other ways you can use a monitor bot for neat things

Normally we see another comment saying (this has been upvoted by blahblah, but I feel that is spam)

Until next time,
Michael Garcia a.k.a. @TheCrazyGM
p.s. I'm still feeling quite sick as why this is so brief and doesn't walk through the code with explanations.

3 columns
2 columns
1 column