Created
January 29, 2017 12:28
-
-
Save yfgeek/e02571ccc0adb06837c08073613b55d8 to your computer and use it in GitHub Desktop.
微信自动回复
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-*- coding: utf-8 -*- | |
import itchat, time, re, sys | |
from itchat.content import * | |
@itchat.msg_register([TEXT]) | |
def text_reply(msg): | |
if u'测试' in msg['Text'] or u'test' in msg['Text'] or u'自动' in msg['Text'] or u'回复' in msg['Text']: | |
itchat.send((u'不要测试辣,我是真机器人~'), msg['FromUserName']) | |
elif u'一凡' in msg['Text']: | |
itchat.send((u'哦?叫我呢?'), msg['FromUserName']) | |
elif u'晚安' in msg['Text']: | |
itchat.send('@[email protected]', msg['FromUserName']) | |
itchat.send((u'晚安 ' + msg['FromUserName']), msg['FromUserName']) | |
elif u'早安' in msg['Text']: | |
itchat.send('@[email protected]', msg['FromUserName']) | |
itchat.send((u'早安安 不过我还在睡觉呐'), msg['FromUserName']) | |
elif u'二凡' in msg['Text']: | |
itchat.send((u'么么哒'), msg['FromUserName']) | |
else: | |
itchat.send((u'nice!我记下来了:\n' + msg['Text'] + u' \n\n是个不错的想法!! \n\n明天再看哦,我还在睡觉~新年快乐~'), msg['FromUserName']) | |
itchat.send('@[email protected]', msg['FromUserName']) | |
@itchat.msg_register([PICTURE, RECORDING, VIDEO, SHARING]) | |
def other_reply(msg): | |
itchat.send((u'nice!明天再看哦,我还在睡觉~新年快乐~ '), msg['FromUserName']) | |
if __name__ == '__main__': | |
default_encoding = 'utf-8' | |
if sys.getdefaultencoding() != default_encoding: | |
itchat.auto_login(enableCmdQR=False,hotReload=True) | |
itchat.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment