本文整理汇总了Python中temba.msgs.models.Msg.process_message方法的典型用法代码示例。如果您正苦于以下问题:Python Msg.process_message方法的具体用法?Python Msg.process_message怎么用?Python Msg.process_message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类temba.msgs.models.Msg
的用法示例。
在下文中一共展示了Msg.process_message方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: default
# 需要导入模块: from temba.msgs.models import Msg [as 别名]
# 或者: from temba.msgs.models.Msg import process_message [as 别名]
def default(self, line):
"""
Sends a message as the current contact's highest priority URN
"""
urn = self.contact.get_urn()
incoming = Msg.create_incoming(None, (urn.scheme, urn.path), line, date=timezone.now(), org=self.org)
Msg.process_message(incoming)
print((Fore.GREEN + "[%s] " + Fore.YELLOW + ">>" + Fore.MAGENTA + " %s" + Fore.WHITE) % (urn.urn, incoming.text))
# look up any message responses
outgoing = Msg.objects.filter(org=self.org, pk__gt=incoming.pk, direction=OUTGOING)
for response in outgoing:
print((Fore.GREEN + "[%s] " + Fore.YELLOW + "<<" + Fore.MAGENTA + " %s" + Fore.WHITE) % (urn.urn, response.text))