“@A @B @C......”
形式显示在输入框,并可以继续编辑消息内容,完成消息发送。
接收方会在会话界面的群聊天列表,重点显示 “有人@我”
或者 “@所有人”
标识,提醒用户有人在群里 @ 自己了。监听 @ 字符选择群成员 | 编辑群 @ 消息发送 | 收到群 @ 消息 |
| | |
Cell
展示 “有人@我” 信息。V2TimMessage
,昵称用来在文本框显示。createTextAtMessage
(Details) 接口创建一条 @ 文本消息,拿到消息对象 V2TIMMessage
,并在其中指定需要 @ 的成员。sendMessage
(Details) 接口将刚才创建的 @ 消息对象发送出去。const text = "123";const atUserList = ['user1','user2','all'];// 创建群@消息const atMsgRes = await TencentImSDKPlugin.v2TIMManager.getMessageManager().createTextAtMessage(text, atUserList);// 发送群@消息TencentImSDKPlugin.v2TIMManager.getMessageManager().sendMessage(id: atMsgRes.data.id,receiver: "",groupID: "",);
V2TimConversation
的 groupAtInfolist
(Details) 接口获取会话的 @ 数据列表。V2TimGroupAtInfo
对象的 atType
(Details) 接口获取 @ 数据类型,并更新到当前会话的 @ 信息。const nextSeq = "";const count = 10;const getConversationList = await TencentImSDKPlugin.v2TIMManager.getConversationManager().getConversationList(nextSeq, count);if (getConversationList.code == 0) {getConversationList.data.conversationList.forEach((element) => {element.groupAtInfoList.forEach((element) => {if (element.atType == 0) {// @我}if (element.atType == 1) {// @all}if (element.atType == 2) {// @all&@我}});});}
本页内容是否解决了您的问题?