Stemmit mention tool -- mention in the wechat when get an upvote
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.
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
Install Python 3.6
Install Steempython
For installing the Steempython lib , you had better use Ubuntu system instead of Windows system.
pip install -U steem
Install wxpy
pip install -U wxpy
Get the code of this project
git pull https://github.com/Cha0s0000/SteemitWechatBot.git
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.
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.
In the main.py line 63,change the template to inform user
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
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
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
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