from fbchat import log, Client
from ais import abc
# Subclass fbchat.Client and override required methods
class EchoBot(Client):
def onMessage(self, author_id, message_object, thread_id, thread_type, **kwargs):
self.markAsDelivered(author_id, thread_id)
self.markAsRead(author_id)
log.info("{} from {} in {}".format(message_object, thread_id, thread_type.name))
# If you're not the author, echo
if author_id != self.uid:
abc(message_object) <-- HERE IS THE PROBLEM
client = EchoBot("email", "password")
client.listen()
问题是message_object而不是发送消息本身(123123)以某种方式变成<Message (id): '123123', mentions=[] emoji_size=None attachments=[]>
我如何解决这个问题以获得所需的结果? (123123)
答案 0 :(得分:0)
尝试替换
abc(message_object)
使用
abc(message_object.text)