从 BaseMessage 获取消息

Get messages from BaseMessage

我在使用 SendBird 时遇到了一些问题。 正如文档所说:

Load previous messages After creating a query instance from the CreatePreviousMessageListQuery() method and using the Load() method which returns a list of message objects, you can retrieve a set number of previous messages in an open channel. With the returned list, you can display the past messages in your UI once they have loaded

使用以下代码:

mPrevMessageListQuery.Load(30, true, (List<BaseMessage> messages, SendBirdException e) => {
    if (e != null) {
        // Error.
        return;
    }
});

但是,我无法从 BaseMessage 获取消息。我需要有 UserMessage。我该怎么做?

我知道了。

    (UsrMSG((UserMessage)baseMessage));

    string UsrMSG(UserMessage message)
    {
        return message.Sender.Nickname + " ha detto: " + message.Message + "\n";
    }

原来如此简单