Stemmit mention tool -- mention in the wechat when get an upvote

in utopian-io •  last year

New Projects

What is the project about?

As all know ,wechat ia a popular communication tool in China with 8 hundred million users.Just like the twitter and facebook

This is a tool that allows you to get a mention message through Wechat application when somebody in Steemit gives a upvote to your post.

Always , we do not sit before the computer to view Steemit for all of our time.So it is necessary to have a mention tool which can remind us of the latest new in the Steemit wherever and whenever we are.

GIF.gif

GIF.gif

图片.png
图片.png


Technology Stack

The project uses a multi thread and the Producer-Consumer as the running framework.

There are 5 threads running at the same time

  • one WechatMem
  • one Producer
  • three Consumer

Firstly,through the thread of WechatMem,get the member of the wechat group,who are the users will get the mention information of the Steemit upvote.

Secondly, while running the thread of Producer to get the latest data the the Steemit block,three threads of Consumer read the queue to get the related data of the upvote.

When getting the data related to the member of the group ,the bot will send a direct message to the user in the Wechat application.

Requirement

  • Python 3.6
  • Steempython
  • wxpy

Setup

  1. Install Python 3.6

  2. Install Steempython

    For installing the Steempython lib , you had better use Ubuntu system instead of Windows system.

    pip install -U steem
    
  3. Install wxpy

    pip install -U wxpy
    
  4. Get the code of this project

    git pull https://github.com/Cha0s0000/SteemitWechatBot.git
    
  5. Edit the code

    class WechatMem(threading.Thread):
        def __init__(self,name,bot,MemberList):
            threading.Thread.__init__(self,name=name)
            self.bot=bot
            self.MemberList=MemberList
        def run(self):
            
            while True:
                SteemitBotWechatGroup = ensure_one(self.bot.groups().search('SteemitBot'))
                SteemitBotWechatGroup.update_group(True)
                for member in SteemitBotWechatGroup:
                    friend = ensure_one(self.bot.friends().search(member.name))
                
                    if (friend.name !=""):
                        # print(friend.remark_name)
                        if friend.name in self.MemberList:
                            continue
                        else:
                            self.MemberList.append(friend.name)
                print('update SteemitBot list')
                print(self.MemberList)
    time.sleep(10)
    
    • In the main.py file line 76.Change it with your own wechat group name.

      图片.png

    class Consumer(threading.Thread):
        def __init__(self,name,queue,MemberList,bot):
            threading.Thread.__init__(self,name=name)
            self.data=queue
            self.MemberList=MemberList
            self.bot=bot
        def run(self):
           
            while True:
                operations = self.data.get()
                   
                if operations != None:
                    for op in operations:
                        # print(op)
                        if op[0] == 'vote':
                            if op[1]['author'] in self.MemberList:
                                voter = op[1]['voter']
                                author = op[1]['author']
                                weight = op[1]['weight']
                                permlink = 'https://steemit.com/@'+author+'/'+op[1]['permlink']
                                postdata = json.dumps(op[1])
                                print(self.MemberList)
                                print("\n")
                                print(postdata)
                                InformFriend = ensure_one(self.bot.friends().search(author))
                                InformFriend.send("@{}\n--------\n你的文章有新点赞\n————————————\nvoter:{}\nweight:{}\npermlink:\n{} ".format(author,voter,weight,permlink))
    
    
    • In the main.py file line 52 and 53,Change the type of operation instead of voting leads to receive other type of mention information.

      图片.png

    • In the main.py line 63,change the template to inform user

      图片.png

  6. Run the code

    python main.py
    


Roadmap

  • Add other types of mention including comments , posts ,transfer , mentions and so on.

    That is to say ,when our post gets comments or upvote ,when we get the transfer or someone`s posts mention me ,we will all get the mention information in the Wechat application

  • Build up a front end web UI to record the user,which can lead to automatic operation from front to end.


How to contribute?

Github: https://github.com/Cha0s0000/SteemitWechatBot

  • Fork it!
  • Create your feature branch: git checkout -b my-new-feature
  • Commit your changes: git commit -am 'Add some feature'
  • Push to the branch: git push origin my-new-feature
  • Submit a pull request.



Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Hey @cha0s0000 I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x