NIMSDK-AOS  10.9.80
V2NIMMessageRobotConfig.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.v2.message.config;
2 
3 import java.io.Serializable;
4 
5 public class V2NIMMessageRobotConfig implements Serializable {
6  // 机器人账号,对应控制台提前设置好的机器人
7  // 仅在群聊中有效,点对点聊天室中该字段会被忽略
8  private final String accountId;
9 
10  // 机器人消息话题
11  private final String topic;
12 
13  // 机器人具体功能,用户可以自定义输入
14  private final String function;
15 
16  // 机器人自定义内容
17  private final String customContent;
18 
19  private V2NIMMessageRobotConfig(String accountId, String topic, String function, String customContent) {
20  this.accountId = accountId;
21  this.topic = topic;
22  this.function = function;
23  this.customContent = customContent;
24  }
25 
26  public String getAccountId() {
27  return accountId;
28  }
29 
30  public String getTopic() {
31  return topic;
32  }
33 
34  public String getFunction() {
35  return function;
36  }
37 
38  public String getCustomContent() {
39  return customContent;
40  }
41 
42  @Override
43  public String toString() {
44  return "V2NIMMessageRobotConfig{" +
45  "accountId='" + accountId + '\'' +
46  ", topic='" + topic + '\'' +
47  ", function='" + function + '\'' +
48  ", customContent='" + customContent + '\'' +
49  '}';
50  }
51 
52  public static final class V2NIMMessageRobotConfigBuilder {
53  private String accountId;
54  private String topic;
55  private String function;
56  private String customContent;
57 
58  private V2NIMMessageRobotConfigBuilder() {
59  }
60 
61  public static V2NIMMessageRobotConfigBuilder builder() {
62  return new V2NIMMessageRobotConfigBuilder();
63  }
64 
65  public V2NIMMessageRobotConfigBuilder withAccountId(String accountId) {
66  this.accountId = accountId;
67  return this;
68  }
69 
70  public V2NIMMessageRobotConfigBuilder withTopic(String topic) {
71  this.topic = topic;
72  return this;
73  }
74 
75  public V2NIMMessageRobotConfigBuilder withFunction(String function) {
76  this.function = function;
77  return this;
78  }
79 
80  public V2NIMMessageRobotConfigBuilder withCustomContent(String customContent) {
81  this.customContent = customContent;
82  return this;
83  }
84 
85  public V2NIMMessageRobotConfig build() {
86  return new V2NIMMessageRobotConfig(accountId, topic, function, customContent);
87  }
88  }
89 }