繁体   English   中英

没有收到来自fbchat的正确消息

[英]Not receiving proper message from fbchat

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)

尝试更换

abc(message_object)

abc(message_object.text)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM