Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

12345678910111213141516171819202122232425262728293031323334353637
  1. """
  2. Message sending channel abstract class
  3. """
  4. from bridge.bridge import Bridge
  5. class Channel(object):
  6. def startup(self):
  7. """
  8. init channel
  9. """
  10. raise NotImplementedError
  11. def handle_text(self, msg):
  12. """
  13. process received msg
  14. :param msg: message object
  15. """
  16. raise NotImplementedError
  17. def send(self, msg, receiver):
  18. """
  19. send message to user
  20. :param msg: message content
  21. :param receiver: receiver channel account
  22. :return:
  23. """
  24. raise NotImplementedError
  25. def build_reply_content(self, query, context=None):
  26. return Bridge().fetch_reply_content(query, context)
  27. def build_voice_to_text(self, voice_file):
  28. return Bridge().fetch_voice_to_text(voice_file)
  29. def build_text_to_voice(self, text):
  30. return Bridge().fetch_text_to_voice(text)