Skip to content

Instantly share code, notes, and snippets.

@wwj718
Created March 16, 2019 05:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wwj718/8377a278193a04aa54b727892e378304 to your computer and use it in GitHub Desktop.
Save wwj718/8377a278193a04aa54b727892e378304 to your computer and use it in GitHub Desktop.
import itchat, time
from itchat.content import TEXT
@itchat.msg_register([TEXT])
def text_reply(msg):
# 不会接受群消息
# msg.user.send('%s: %s' % (msg.type, msg.text))
# author = itchat.search_friends(nickName='Finn')[0]
# author.send('hi ,我正通过codelab的Scratch界面与你聊天!')
content = msg.text
user = msg.user["NickName"]
# from IPython import embed;embed()
@itchat.msg_register(TEXT, isGroupChat=True)
def group_text_reply(msg):
from IPython import embed;embed()
if msg.isAt:
msg.user.send(u'@%s\u2005I received: %s' % (
msg.actualNickName, msg.text))
itchat.auto_login()
itchat.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment