Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathtest_sendFriendStreamMessage.java
More file actions
Latest commit
49 lines (47 loc) · 2.05 KB
/
Copy pathtest_sendFriendStreamMessage.java
File metadata and controls
49 lines (47 loc) · 2.05 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
importio.github.kloping.qqbot.Starter;
importio.github.kloping.qqbot.api.v2.FriendMessageEvent;
importio.github.kloping.qqbot.http.data.StreamMessageData;
importio.github.kloping.qqbot.http.data.V2Result;
importio.github.kloping.qqbot.impl.ListenerHost;
/**
* @author github.kloping
*/
publicclasstest_sendFriendStreamMessage {
publicstaticvoidmain(String[] args) throwsException {
Starterstarter = test_main.factory();
starter.run();
starter.registerListenerHost(newListenerHost() {
@EventReceiver
publicvoidonFriendStreamMessage(FriendMessageEventevent) throwsInterruptedException {
String[] line = "这是,一段话,每秒从1...10,1,2,3,4,5,6,7,8,9,10".split(",");
intindex = 0;
V2Resultresult = null;
for (Strings : line) {
StreamMessageDatastreamMessageData = null;
if (index == 0) {
streamMessageData = newStreamMessageData()
.setIndex(0)
.setContent_raw(s);
} else {
streamMessageData = newStreamMessageData()
.setIndex(index)
.setContent_raw(s)
.setStream_msg_id(result.getId());
}
index++;
result = event.sendStreamMessage(streamMessageData);
System.out.println(result);
Thread.sleep(700);
}
StreamMessageDatastreamMessageData = newStreamMessageData()
.setIndex(index)
.setContent_raw(".")
.setStream_msg_id(result.getId())
.setInput_state(StreamMessageData.INPUT_STATE_FINISHED);
index++;
result = event.sendStreamMessage(streamMessageData);
System.out.println(result);
}
});
}
}