Skip to content
This repository was archived by the owner on May 23, 2025. It is now read-only.

Commit 248eaa7

Browse files
committed
update
1 parent 62eaaf7 commit 248eaa7

File tree

14 files changed

+413
-474
lines changed

14 files changed

+413
-474
lines changed

command/src/main/java/io/github/minecraftchampions/dodoopenjava/command/CommandSender.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public void muteSender(int Time) throws IOException {
145145
* @throws IOException 失败后抛出
146146
*/
147147
public void muteSender(int Time, String reason) throws IOException {
148-
MemberApi.addMemberReasonrMute(Command.Authorization, IslandSourceId, SenderDodoSourceId, Time, reason);
148+
MemberApi.addMemberReasonMute(Command.Authorization, IslandSourceId, SenderDodoSourceId, Time, reason);
149149
}
150150

151151
/**

core/src/main/java/io/github/minecraftchampions/dodoopenjava/api/v2/BotApi.java

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ public static JSONObject getBotInfo(String clientId, String token) throws IOExce
3232
*/
3333
public static JSONObject getBotInfo(String authorization) throws IOException {
3434
String url = "https://botopen.imdodo.com/api/v2/bot/info";
35-
String param = "{}";
36-
return new JSONObject(NetUtil.sendRequest(param, url, authorization));
35+
JSONObject jsonObject = new JSONObject();
36+
return new JSONObject(NetUtil.sendRequest(jsonObject.toString(), url, authorization));
3737
}
3838

3939
/**
@@ -59,10 +59,9 @@ public static JSONObject setBotIslandLeave(String clientId, String token, String
5959
*/
6060
public static JSONObject setBotIslandLeave(String authorization, String islandSourceId) throws IOException {
6161
String url = "https://botopen.imdodo.com/api/v2/bot/island/leave";
62-
String param = "{" +
63-
" \"islandSourceId\": \"" + islandSourceId + "\"" +
64-
"}";
65-
return new JSONObject(NetUtil.sendRequest(param, url, authorization));
62+
JSONObject jsonObject = new JSONObject();
63+
jsonObject.put("islandSourceId", islandSourceId);
64+
return new JSONObject(NetUtil.sendRequest(jsonObject.toString(), url, authorization));
6665
}
6766

6867
/**
@@ -76,11 +75,10 @@ public static JSONObject setBotIslandLeave(String authorization, String islandSo
7675
*/
7776
public static JSONObject getBotInviteList(String authorization, int pageSize, long maxId) throws IOException {
7877
String url = "https://botopen.imdodo.com/api/v2/bot/invite/list";
79-
String param = "{" +
80-
" \"pageSize\":" + pageSize + "," +
81-
" \"maxId\":" + maxId + "" +
82-
"}";
83-
return new JSONObject(NetUtil.sendRequest(param, url, authorization));
78+
JSONObject jsonObject = new JSONObject();
79+
jsonObject.put("pageSize", pageSize)
80+
.put("maxId", maxId);
81+
return new JSONObject(NetUtil.sendRequest(jsonObject.toString(), url, authorization));
8482
}
8583

8684
/**
@@ -93,10 +91,9 @@ public static JSONObject getBotInviteList(String authorization, int pageSize, lo
9391
*/
9492
public static JSONObject addBotInvite(String authorization, String dodoSourceId) throws IOException {
9593
String url = "https://botopen.imdodo.com/api/v2/bot/invite/add";
96-
String param = "{" +
97-
" \"dodoSourceId\": \"" + dodoSourceId + "\"" +
98-
"}";
99-
return new JSONObject(NetUtil.sendRequest(param, url, authorization));
94+
JSONObject jsonObject = new JSONObject();
95+
jsonObject.put("dodoSourceId", dodoSourceId);
96+
return new JSONObject(NetUtil.sendRequest(jsonObject.toString(), url, authorization));
10097
}
10198

10299
/**
@@ -109,9 +106,8 @@ public static JSONObject addBotInvite(String authorization, String dodoSourceId)
109106
*/
110107
public static JSONObject removeBotInvite(String authorization, String dodoSourceId) throws IOException {
111108
String url = "https://botopen.imdodo.com/api/v2/bot/invite/remove";
112-
String param = "{" +
113-
" \"dodoSourceId\": \"" + dodoSourceId + "\"" +
114-
"}";
115-
return new JSONObject(NetUtil.sendRequest(param, url, authorization));
109+
JSONObject jsonObject = new JSONObject();
110+
jsonObject.put("dodoSourceId", dodoSourceId);
111+
return new JSONObject(NetUtil.sendRequest(jsonObject.toString(), url, authorization));
116112
}
117113
}

core/src/main/java/io/github/minecraftchampions/dodoopenjava/api/v2/ChannelApi.java

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,9 @@ public static JSONObject getChannelList(String clientId, String token, String is
3434
*/
3535
public static JSONObject getChannelList(String authorization, String islandSourceId) throws IOException {
3636
String url = "https://botopen.imdodo.com/api/v2/channel/list";
37-
String param = "{" +
38-
" \"islandSourceId\": \"" + islandSourceId + "\"" +
39-
"}";
40-
return new JSONObject(NetUtil.sendRequest(param, url, authorization));
37+
JSONObject jsonObject = new JSONObject();
38+
jsonObject.put("islandSourceId", islandSourceId);
39+
return new JSONObject(NetUtil.sendRequest(jsonObject.toString(), url, authorization));
4140
}
4241

4342
/**
@@ -63,10 +62,9 @@ public static JSONObject getChannelInfo(String clientId, String token, String ch
6362
*/
6463
public static JSONObject getChannelInfo(String authorization, String channelId) throws IOException {
6564
String url = "https://botopen.imdodo.com/api/v2/channel/info";
66-
String param = "{" +
67-
" \"channelId\": \"" + channelId + "\"" +
68-
"}";
69-
return new JSONObject(NetUtil.sendRequest(param, url, authorization));
65+
JSONObject jsonObject = new JSONObject();
66+
jsonObject.put("channelId", channelId);
67+
return new JSONObject(NetUtil.sendRequest(jsonObject.toString(), url, authorization));
7068
}
7169

7270
/**
@@ -96,12 +94,11 @@ public static JSONObject addChannel(String clientId, String token, String island
9694
*/
9795
public static JSONObject addChannel(String authorization, String islandSourceId, String channelName, int channelType) throws IOException {
9896
String url = "https://botopen.imdodo.com/api/v2/channel/add";
99-
String param = "{" +
100-
" \"islandSourceId\": \"" + islandSourceId + "\"," +
101-
" \"channelName\": \"" + channelName + "\"," +
102-
" \"channelType\": " + channelType + "" +
103-
"}";
104-
return new JSONObject(NetUtil.sendRequest(param, url, authorization));
97+
JSONObject jsonObject = new JSONObject();
98+
jsonObject.put("islandSourceId", islandSourceId)
99+
.put("channelName", channelName)
100+
.put("channelType", channelType);
101+
return new JSONObject(NetUtil.sendRequest(jsonObject.toString(), url, authorization));
105102
}
106103

107104
/**
@@ -131,12 +128,11 @@ public static JSONObject editChannel(String clientId, String token, String islan
131128
*/
132129
public static JSONObject editChannel(String authorization, String islandSourceId, String channelName, String channelId) throws IOException {
133130
String url = "https://botopen.imdodo.com/api/v2/channel/edit";
134-
String param = "{" +
135-
" \"islandSourceId\": \"" + islandSourceId + "\"," +
136-
" \"channelId\": \"" + channelId + "\"," +
137-
" \"channelName\": \"" + channelName + "\"" +
138-
"}";
139-
return new JSONObject(NetUtil.sendRequest(param, url, authorization));
131+
JSONObject jsonObject = new JSONObject();
132+
jsonObject.put("islandSourceId", islandSourceId)
133+
.put("channelName", channelName)
134+
.put("channelId", channelId);
135+
return new JSONObject(NetUtil.sendRequest(jsonObject.toString(), url, authorization));
140136
}
141137

142138
/**
@@ -164,10 +160,9 @@ public static JSONObject deleteChannel(String clientId, String token, String isl
164160
*/
165161
public static JSONObject deleteChannel(String authorization, String islandSourceId, String channelId) throws IOException {
166162
String url = "https://botopen.imdodo.com/api/v2/channel/remove";
167-
String param = "{" +
168-
" \"islandSourceId\": \"" + islandSourceId + "\"," +
169-
" \"channelId\": \"" + channelId + "\"" +
170-
"}";
171-
return new JSONObject(NetUtil.sendRequest(param, url, authorization));
163+
JSONObject jsonObject = new JSONObject();
164+
jsonObject.put("islandSourceId", islandSourceId)
165+
.put("channelId", channelId);
166+
return new JSONObject(NetUtil.sendRequest(jsonObject.toString(), url, authorization));
172167
}
173168
}

core/src/main/java/io/github/minecraftchampions/dodoopenjava/api/v2/ChannelArticleApi.java

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,12 @@ public static JSONObject addChannelArticle(String channelId, String title, Strin
3939
*/
4040
public static JSONObject addChannelArticle(String channelId, String title, String content, String imageUrl, String authorization) throws IOException {
4141
String url = "https://botopen.imdodo.com/api/v2/channel/article/add";
42-
String param = "{" +
43-
" \"channelId\": \"" + channelId + "\"," +
44-
" \"title\": \"" + title + "\"," +
45-
" \"content\": \"" + content + "\"," +
46-
" \"imageUrl\": \"" + imageUrl + "\"" +
47-
"}";
48-
return new JSONObject(NetUtil.sendRequest(param, url, authorization));
42+
JSONObject jsonObject = new JSONObject();
43+
jsonObject.put("title", title)
44+
.put("channelId", channelId)
45+
.put("content", content)
46+
.put("imageUrl", imageUrl);
47+
return new JSONObject(NetUtil.sendRequest(jsonObject.toString(), url, authorization));
4948
}
5049

5150

@@ -76,12 +75,11 @@ public static JSONObject removeChannelArticle(int type, String id, String channe
7675
*/
7776
public static JSONObject removeChannelArticle(int type, String id, String channelId, String authorization) throws IOException {
7877
String url = "https://botopen.imdodo.com/api/v2/channel/article/remove";
79-
String param = "{" +
80-
" \"id\": \"" + id + "\"," +
81-
" \"type\": " + type + "," +
82-
" \"channelId\": \"" + channelId + "\"" +
83-
"}";
84-
return new JSONObject(NetUtil.sendRequest(param, url, authorization));
78+
JSONObject jsonObject = new JSONObject();
79+
jsonObject.put("id", id)
80+
.put("channelId", channelId)
81+
.put("type", type);
82+
return new JSONObject(NetUtil.sendRequest(jsonObject.toString(), url, authorization));
8583
}
8684

8785
}

0 commit comments

Comments
 (0)