/
Channel.java
199 lines (177 loc) · 9.43 KB
/
Channel.java
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
/*
* Copyright 2015-2016 Austin Keener & Michael Ritter
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.dv8tion.jda.core.entities;
import net.dv8tion.jda.core.JDA;
import net.dv8tion.jda.core.managers.ChannelManager;
import net.dv8tion.jda.core.managers.ChannelManagerUpdatable;
import net.dv8tion.jda.core.requests.RestAction;
import net.dv8tion.jda.core.requests.restaction.InviteAction;
import java.util.List;
/**
* Represents a {@link net.dv8tion.jda.core.entities.Guild Guild} channel.
*/
public interface Channel extends ISnowflake
{
/**
* The human readable name of the Channel.<br>
* If no name has been set, this returns null.
*
* @return
* The name of this Channel
*/
String getName();
/**
* Returns the {@link net.dv8tion.jda.core.entities.Guild Guild} that this Channel is part of.
*
* @return
* Never-null {@link net.dv8tion.jda.core.entities.Guild Guild} that this Channel is part of.
*/
Guild getGuild();
/**
* A List of all {@link net.dv8tion.jda.core.entities.Member Members} that are in this Channel
* For {@link net.dv8tion.jda.core.entities.TextChannel TextChannels}, this returns all Members with the {@link net.dv8tion.jda.core.Permission#MESSAGE_READ} Permission.
* In {@link net.dv8tion.jda.core.entities.VoiceChannel VoiceChannels}, this returns all Members that joined that VoiceChannel.
*
* @return
* A List of {@link net.dv8tion.jda.core.entities.Member Members} that are in this Channel.
*/
List<Member> getMembers();
/**
* The position this Channel is displayed at.<br>
* Higher values mean they are displayed lower in the Client. Position 0 is the top most Channel
* Channels of a {@link net.dv8tion.jda.core.entities.Guild Guild} do not have to have continuous positions
*
* @return
* Zero-based int of position of the Channel.
*/
int getPosition();
/**
* The actual position of the {@link net.dv8tion.jda.core.entities.Channel Channel} as stored and given by Discord.
* Role positions are actually based on a pairing of the creation time (as stored in the snowflake id)
* and the position. If 2 or more roles share the same position then they are sorted based on their creation date.
* The more recent a role was created, the lower it is in the hierachy. This is handled by {@link #getPosition()}
* and it is most likely the method you want. If, for some reason, you want the actual position of the
* Role then this method will give you that value.
*
* @return
* The true, Discord stored, position of the {@link net.dv8tion.jda.core.entities.Channel Channel}.
*/
int getPositionRaw();
// /**
// * Returns the {@link net.dv8tion.jda.managers.ChannelManager ChannelManager} for this Channel.
// * In the ChannelManager, you can modify the name, topic and position of this Channel.
// *
// * @return
// * The ChannelManager of this Channel
// */
// ChannelManager getManager();
/**
* Returns the {@link net.dv8tion.jda.core.JDA JDA} instance of this Channel
* @return
* the corresponding JDA instance
*/
JDA getJDA();
/**
* The {@link PermissionOverride} relating to the specified {@link net.dv8tion.jda.core.entities.User User}.
* If there is no {@link net.dv8tion.jda.core.entities.PermissionOverride PermissionOverride} for this {@link net.dv8tion.jda.core.entities.Channel Channel}
* relating to the provided {@link net.dv8tion.jda.core.entities.User User}, then this returns <code>null</code>.
*
* @param member
* The {@link net.dv8tion.jda.core.entities.Member Member} whose {@link net.dv8tion.jda.core.entities.PermissionOverride PermissionOverride} is requested.
* @return
* Possibly-null {@link net.dv8tion.jda.core.entities.PermissionOverride PermissionOverride} relating to the provided {@link net.dv8tion.jda.core.entities.User User}.
*/
PermissionOverride getPermissionOverride(Member member);
/**
* The {@link PermissionOverride} relating to the specified {@link net.dv8tion.jda.core.entities.Role Role}.
* If there is no {@link net.dv8tion.jda.core.entities.PermissionOverride PermissionOverride} for this {@link net.dv8tion.jda.core.entities.Channel Channel}
* relating to the provided {@link net.dv8tion.jda.core.entities.Role Role}, then this returns <code>null</code>.
*
* @param role
* The {@link net.dv8tion.jda.core.entities.User Role} whose {@link net.dv8tion.jda.core.entities.PermissionOverride PermissionOverride} is requested.
* @return
* Possibly-null {@link net.dv8tion.jda.core.entities.PermissionOverride PermissionOverride} relating to the provided {@link net.dv8tion.jda.core.entities.Role Role}.
*/
PermissionOverride getPermissionOverride(Role role);
/**
* Gets all of the {@link net.dv8tion.jda.core.entities.PermissionOverride PermissionOverrides} that are part
* of this {@link net.dv8tion.jda.core.entities.Channel Channel}.<br>
* This combines {@link net.dv8tion.jda.core.entities.User User} and {@link net.dv8tion.jda.core.entities.Role Role} overrides.
* If you would like only {@link net.dv8tion.jda.core.entities.User} overrides or only {@link net.dv8tion.jda.core.entities.Role Role}
* overrides, use {@link #getMemberPermissionOverrides()} ()} or {@link #getRolePermissionOverrides()} respectively.
*
* @return
* Possibly-empty list of all {@link net.dv8tion.jda.core.entities.PermissionOverride PermissionOverrides} for this {@link net.dv8tion.jda.core.entities.Channel Channel}.
*/
List<PermissionOverride> getPermissionOverrides();
/**
* Gets all of the {@link net.dv8tion.jda.core.entities.Member Member} {@link net.dv8tion.jda.core.entities.PermissionOverride PermissionOverrides}
* that are part of this {@link net.dv8tion.jda.core.entities.Channel Channel}.
*
* @return
* Possibly-empty list of all {@link net.dv8tion.jda.core.entities.PermissionOverride PermissionOverrides} for {@link net.dv8tion.jda.core.entities.Member Member}
* for this {@link net.dv8tion.jda.core.entities.Channel Channel}.
*/
List<PermissionOverride> getMemberPermissionOverrides();
/**
* Gets all of the {@link net.dv8tion.jda.core.entities.Role Role} {@link net.dv8tion.jda.core.entities.PermissionOverride PermissionOverrides}
* that are part of this {@link net.dv8tion.jda.core.entities.Channel Channel}.
*
* @return
* Possibly-empty list of all {@link net.dv8tion.jda.core.entities.PermissionOverride PermissionOverrides} for {@link net.dv8tion.jda.core.entities.Role Roles}
* for this {@link net.dv8tion.jda.core.entities.Channel Channel}.
*/
List<PermissionOverride> getRolePermissionOverrides();
/**
* Returns the {@link net.dv8tion.jda.core.managers.ChannelManager ChannelManager} for this Channel.
* In the ChannelManager, you can modify the name, topic and position of this Channel.
*
* @return
* The ChannelManager of this Channel
*/
ChannelManager getManager();
ChannelManagerUpdatable getManagerUpdatable();
RestAction<Void> delete();
RestAction<PermissionOverride> createPermissionOverride(Member member);
RestAction<PermissionOverride> createPermissionOverride(Role role);
/**
* Creates a new {@link net.dv8tion.jda.core.requests.restaction.InviteAction InviteAction} which can be used to create a
* new {@link net.dv8tion.jda.core.entities.Invite Invite}.
* <br>Requires {@link net.dv8tion.jda.core.Permission#CREATE_INSTANT_INVITE CREATE_INSTANT_INVITE} in this channel.
*
* @throws net.dv8tion.jda.core.exceptions.PermissionException
* if the account does not have {@link net.dv8tion.jda.core.Permission#CREATE_INSTANT_INVITE CREATE_INSTANT_INVITE} in this channel
*
* @return A new {@link net.dv8tion.jda.core.requests.restaction.InviteAction InviteAction}
*
* @see net.dv8tion.jda.core.requests.restaction.InviteAction
*/
InviteAction createInvite();
/**
* Returns all invites for this channel.
* <br>Requires {@link net.dv8tion.jda.core.Permission#MANAGE_CHANNEL MANAGE_CHANNEL} in this channel.
* Will throw a {@link net.dv8tion.jda.core.exceptions.PermissionException PermissionException} otherwise.
*
* @throws net.dv8tion.jda.core.exceptions.PermissionException
* if the account does not have {@link net.dv8tion.jda.core.Permission#MANAGE_CHANNEL MANAGE_CHANNEL} in this channel
*
* @return {@link net.dv8tion.jda.core.requests.RestAction RestAction} - Type: List{@literal <}{@link net.dv8tion.jda.core.entities.Invite Invite}{@literal >}
* <br>The list of expanded Invite objects
*
* @see net.dv8tion.jda.core.entities.Guild#getInvites()
*/
RestAction<List<Invite>> getInvites();
}