Skip to content

增加了图片后缀自动判断

Compare
Choose a tag to compare
@littlecodersh littlecodersh released this 17 Mar 02:36
· 30 commits to master since this release

获取用户头像:

import itchat, shutil

itchat.auto_login(True)

r = itchat.get_head_img(picDir='tmp.unknown')
print(r)
if 'PostFix' in r:
    shutil.move('tmp.unknown', 'tmp.%s' % r['PostFix'])

获取聊天图片:

import itchat, shutil

itchat.auto_login(True)

@itchat.msg_register(itchat.content.PICTURE)
def download(msg):
    r = msg['Text']('tmp.unknown')
    print(r)
    if 'PostFix' in r:
        shutil.move('tmp.unknown', 'tmp.%s' % r['PostFix'])

itchat.run()