Ai
2 Star 9 Fork 5

融云 RongCloud/server-sdk-java

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
GagExample.java 2.25 KB
一键复制 编辑 原始数据 按行查看 历史
huhangtao 提交于 2025-03-14 09:57 +08:00 . FEAT(m-5337441553):translation
package io.rong.example.chatroom;
import io.rong.CenterEnum;
import io.rong.RongCloud;
import io.rong.methods.chatroom.gag.Gag;
import io.rong.models.chatroom.ChatroomMember;
import io.rong.models.chatroom.ChatroomModel;
import io.rong.models.response.ListGagChatroomUserResult;
import io.rong.models.response.ResponseResult;
/**
* Example of Chatroom Mute
* @author RongCloud
*/
public class GagExample {
/**
* Replace with your App Key
* */
private static final String appKey = "appKey";
/**
* Replace with your App Secret
* */
private static final String appSecret = "appSecret";
public static void main(String[] args) throws Exception {
RongCloud rongCloud = RongCloud.getInstance(appKey, appSecret, CenterEnum.BJ);
//Custom API URL
//RongCloud rongCloud = RongCloud.getInstance(appKey, appSecret,api);
Gag gag = rongCloud.chatroom.gag;
/**
*
* Add a muted user to the chatroom (When you want to prevent a user from sending messages in a chatroom, you can mute them.
* The muted user can still receive and view messages in the chatroom but cannot send messages.)
*/
ChatroomMember[] members = {
new ChatroomMember().setId("qawr34h"),new ChatroomMember().setId("qawr35h")
};
ChatroomModel chatroom = new ChatroomModel()
.setId("hjhf07kk")
.setMembers(members)
.setMinute(5);
ResponseResult result = gag.add(chatroom);
System.out.println("addGagUser: " + result.toString());
/**
*
* Method to query muted chatroom members
*/
chatroom = new ChatroomModel()
.setId("hjhf07kk");
ListGagChatroomUserResult chatroomListGagUserResult = gag.getList(chatroom);
System.out.println("ListGagUser: " + chatroomListGagUserResult.toString());
/**
*
*
*
* Method to remove muted chatroom members
*/
chatroom = new ChatroomModel()
.setId("hjhf07kk")
.setMembers(members);
ResponseResult removeResult = gag.remove(chatroom);
System.out.println("rollbackGagUser: " + result.toString());
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/rongcloud/server-sdk-java.git
git@gitee.com:rongcloud/server-sdk-java.git
rongcloud
server-sdk-java
server-sdk-java
master

搜索帮助