def text_reply(msg): #######################指令区#################### if msg['FromUserName'] != msg['ToUserName']: return if msg['Text'] == u'打开CMD': #测试未通过 os.system('cmd') return 'OK!' if msg['Text'] == u'打开记事本': os.system('notepad') return 'OK!' if msg['Text'] == u'自动关机': os.system('Shutdown.exe -s -t 60') return 'OK!' if msg['Text'] == u'打开TGP': os.system(u'tgp_daemon.exe') return 'OK!' #为了防止弹出权限提示不直接打开,需要以管理员身份运行此程序 if msg['Text'] == u'打开网易云': os.system(u'cloudmusic.exe') return 'OK!' if u'播放' in msg['Text']: interact_select_song(msg['Text'].replace(u'播放', '')) return 'OK!' if msg['Text'] == u'关闭播放': close_music() return 'OK!' #########################指令区完######################## return 'error'
def music_player(msg): if msg['ToUserName'] != 'filehelper': return if msg['Text'] == u'关闭': close_music() itchat.send(u'音乐已关闭', 'filehelper') if msg['Text'] == u'帮助': itchat.send(u'帮助信息', 'filehelper') else: itchat.send(interact_select_song(msg['Text']), 'filehelper')
def music_player(msg): if msg['ToUserName'] != 'filehelper': return if msg['Text'] == u'关闭': close_music() itchat.send(u'音乐已关闭', 'filehelper') if msg['Text'] == u'帮助': itchat.send(HELP_MSG, 'filehelper') else: itchat.send(interact_select_song(msg['Text']), 'filehelper')
def music_player(msg): # print(msg) if msg["ToUserName"] != 'filehelper': return if msg['Text'] == u'关闭': stop_music() itchat.send(u'音乐已关闭', 'filehelper') elif msg['Text'] == u'帮助': itchat.send(HELP_MSG, 'filehelper') else: itchat.send(interact_select_song(msg['Text']), 'filehelper')
def music_player(msg): if msg['ToUserName'] != 'filehelper': return if msg['Text'] == 'schliessen': close_music() itchat.send('Musik hat geschlossen', 'filehelper') if msg['Text'] == 'helfen': itchat.send('Info bei Helfen', 'filehelper') else: itchat.send(interact_select_song(msg['Text']), 'filehelper')
def text_reply(msg): if msg['ToUserName'] == 'filehelper': if msg['Text'] == u'关闭': close_music() itchat.send(u'音乐已关闭', 'filehelper') if msg['Text'] == u'帮助': itchat.send(HELP_MSG, 'filehelper') else: itchat.send(interact_select_song(msg['Text']), 'filehelper') else: if u'作者' in msg['Text'] or u'主人' in msg['Text']: return u'Jack Yang' elif u'获取图片' in msg['Text']: itchat.send('@[email protected]', msg['FromUserName']) # there should be a picture elif u'每日一图' in msg['Text']: fileName, description = getRanPic("aa") img_msg= '@img@%s' % fileName itchat.send(img_msg, msg['FromUserName']) # there should be a picture return description else: print msg['Text'] return get_response(msg['Text']) or u'收到:' + msg['Text']
import sys from NetEaseMusicApi import interact_select_song lst = interact_select_song(u'南山南') print(lst)