Conversejs支持通过插件获取indexedDb中的存档消息,

edqdpe6u  于 2022-12-09  发布在  IndexedDB
关注(0)|答案(1)|浏览(147)

如果可能的话,请告诉我conversejs如何通过插件获取indexedDb中存储的消息?我想创建自己的聊天历史列表界面,因为controlbox不适合我的业务。

jtjikinw

jtjikinw1#

消息存储在集合中,集合设置为ChatBox模型上的messages属性。ChatBox表示与特定联系人的聊天对话。

converse.plugins.add("my-plugin", {
  
  initialize() {
    const { api } = this._converse;
    const chat = api.chats.get('contact@example.org');

    // log all messages to the console
    chat.messages.forEach(m => console.log(m.get('body'));
  }

});

相关问题