File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
src/main/java/top/focess/qq Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 1
1
package top .focess .qq .api .bot ;
2
2
3
+ import org .checkerframework .checker .nullness .qual .NonNull ;
4
+
5
+ import java .util .List ;
6
+
3
7
public interface Group extends Speaker {
4
8
5
9
/**
@@ -22,5 +26,11 @@ public interface Group extends Speaker{
22
26
*/
23
27
Member getMemberOrFail (long id );
24
28
29
+ /**
30
+ * Get the group's all members
31
+ * @return the all members
32
+ */
33
+ @ NonNull
34
+ List <Member > getMembers ();
25
35
26
36
}
Original file line number Diff line number Diff line change 1
1
package top .focess .qq .core .bot ;
2
2
3
3
import com .google .common .collect .Maps ;
4
+ import org .checkerframework .checker .nullness .qual .NonNull ;
4
5
import org .jetbrains .annotations .Nullable ;
5
6
import top .focess .qq .api .bot .Bot ;
6
7
import top .focess .qq .api .bot .Group ;
7
8
import top .focess .qq .api .bot .Member ;
8
9
10
+ import java .util .List ;
9
11
import java .util .Map ;
12
+ import java .util .Objects ;
13
+ import java .util .stream .Collectors ;
10
14
11
15
public class SimpleGroup extends SimpleSpeaker implements Group {
12
16
@@ -51,6 +55,12 @@ public Member getMember(long id) {
51
55
52
56
@ Override
53
57
public Member getMemberOrFail (long id ) {
54
- return SimpleMember .get (this ,this .nativeGroup .getOrFail (id ));
58
+ return Objects . requireNonNull ( SimpleMember .get (this ,this .nativeGroup .getOrFail (id ) ));
55
59
}
60
+
61
+ @ Override
62
+ public @ NonNull List <Member > getMembers () {
63
+ return this .nativeGroup .getMembers ().stream ().map (i -> SimpleMember .get (this ,i )).collect (Collectors .toList ());
64
+ }
65
+
56
66
}
You can’t perform that action at this time.
0 commit comments