wxpy
微信機器人 / 可能是最優(yōu)雅的微信個人號 API
wxpy
在 itchat
的基礎(chǔ)上,通過大量接口優(yōu)化提升了模塊的易用性没陡,并進行豐富的功能擴展
主頁:https://wxpy.readthedocs.io/zh/latest/
在項目的主頁有最簡單的應(yīng)用计露。
#coding=utf-8
#微信自動回復(fù)
from wxpy import *
if __name__ == '__main__':
bot = Bot()
# my_friend = bot.friends()
# 打印來自其他好友、群聊和公眾號的消息
@bot.register()
def print_others(msg):
# 排除群聊
friend = msg.sender
if type(friend) == Friend:
print (' is friend')
friend.send(u'【您好,我現(xiàn)在有事不在粘舟,一會再和您聯(lián)系深胳〈掳蹋】')
elif type(friend) == Group:
print (' is group')
print(msg)
# (優(yōu)先匹配后注冊的函數(shù)!)
# 阻塞進程
bot.join()
自動回復(fù)的時候要注意排除群聊。舞终。轻庆。
高級功能,還沒搞過敛劝。