-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChatbox.java
More file actions
59 lines (50 loc) · 2.01 KB
/
Chatbox.java
File metadata and controls
59 lines (50 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// java examples.forum.Chatbox YOUR_TOKEN
package examples.forum;
import com.lolzteam.LolzteamClient;
import com.lolzteam.models.*;
public class Chatbox {
public static void main(String[] args) throws Exception {
if (args.length < 1) {
System.err.println("Usage: Chatbox <TOKEN>");
System.exit(1);
}
LolzteamClient client = LolzteamClient.create(args[0]);
var forum = client.forum();
System.out.println("--- chatbox index ---");
try {
ChatboxIndexResponse resp = forum.chatboxIndex(null);
System.out.println("rooms: " + resp.getRooms());
} catch (Exception e) {
System.err.println("err: " + e.getMessage());
}
System.out.println("\n--- chatbox messages ---");
try {
ChatboxGetMessagesResponse resp = forum.chatboxGetMessages("general", null);
System.out.println("messages: " + resp.getMessages());
} catch (Exception e) {
System.err.println("skip: " + e.getMessage());
}
System.out.println("\n--- chatbox online ---");
try {
ChatboxOnlineResponse resp = forum.chatboxOnline(null);
System.out.println("online: " + resp.getUsers());
} catch (Exception e) {
System.err.println("skip: " + e.getMessage());
}
System.out.println("\n--- chatbox leaderboard ---");
try {
ChatboxGetLeaderboardResponse resp = forum.chatboxGetLeaderboard(null);
System.out.println("leaderboard: " + resp.getLeaderboard());
} catch (Exception e) {
System.err.println("skip: " + e.getMessage());
}
System.out.println("\n--- ignore list ---");
try {
ChatboxGetIgnoreResponse resp = forum.chatboxGetIgnore();
System.out.println("ignored: " + resp.getIgnored());
} catch (Exception e) {
System.err.println("skip: " + e.getMessage());
}
System.out.println("\ndone");
}
}