Private.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. from SendMessage import send_message,upload_file
  2. import os
  3. nextcloud = '/var/snap/nextcloud/common/nextcloud/data/zymwin/files'
  4. def command(rev):
  5. qq = rev['sender']['user_id']
  6. rmsg = rev["raw_message"]
  7. if rmsg == "/help":
  8. with open("resource/help.txt",'r') as f:
  9. help = f.read()
  10. send_message('private', qq, help)
  11. elif rmsg[0:9] == "/addsche ":
  12. print("addsche")
  13. elif rmsg[0:9] == "/delsche ":
  14. print("delsche")
  15. elif rmsg[0:10] == "/showsche ":
  16. print("showsche")
  17. def debug(rev):
  18. qq = rev['sender']['user_id']
  19. rmsg = rev["raw_message"]
  20. send_message('private', qq, 'Start to Debug!')
  21. # upload_file('private',qq,'/var/snap/nextcloud/common/nextcloud/data/zymwin/files/Documents/思政课社会实践/张晏铭个人心得体会.docx','docx')
  22. rls = os.listdir(nextcloud)
  23. str = ''
  24. for i in range(len(rls)):
  25. str = str + '/' + rls[i]
  26. if i < len(rls) - 1:
  27. str = str + '\n'
  28. send_message('private', qq, str)
  29. def private_msg(rev):
  30. if rev["raw_message"][0] == "/":
  31. command(rev)
  32. elif rev["raw_message"] == "*":
  33. debug(rev)