from SendMessage import send_message,upload_file import os nextcloud = '/var/snap/nextcloud/common/nextcloud/data/zymwin/files' def command(rev): qq = rev['sender']['user_id'] rmsg = rev["raw_message"] if rmsg == "/help": with open("resource/help.txt",'r') as f: help = f.read() send_message('private', qq, help) elif rmsg[0:9] == "/addsche ": print("addsche") elif rmsg[0:9] == "/delsche ": print("delsche") elif rmsg[0:10] == "/showsche ": print("showsche") def debug(rev): qq = rev['sender']['user_id'] rmsg = rev["raw_message"] send_message('private', qq, 'Start to Debug!') # upload_file('private',qq,'/var/snap/nextcloud/common/nextcloud/data/zymwin/files/Documents/思政课社会实践/张晏铭个人心得体会.docx','docx') rls = os.listdir(nextcloud) str = '' for i in range(len(rls)): str = str + '/' + rls[i] if i < len(rls) - 1: str = str + '\n' send_message('private', qq, str) def private_msg(rev): if rev["raw_message"][0] == "/": command(rev) elif rev["raw_message"] == "*": debug(rev)