|
15 | 15 | */
|
16 | 16 | package net.dv8tion.jda.api.entities.channel.middleman;
|
17 | 17 |
|
18 |
| -import net.dv8tion.jda.api.entities.Guild; |
19 |
| -import net.dv8tion.jda.api.entities.Message; |
20 |
| -import net.dv8tion.jda.api.entities.MessageEmbed; |
21 |
| -import net.dv8tion.jda.api.entities.MessageHistory; |
| 18 | +import net.dv8tion.jda.api.entities.*; |
22 | 19 | import net.dv8tion.jda.api.entities.channel.Channel;
|
23 | 20 | import net.dv8tion.jda.api.entities.channel.concrete.GroupChannel;
|
24 | 21 | import net.dv8tion.jda.api.entities.channel.concrete.PrivateChannel;
|
@@ -2122,6 +2119,10 @@ default RestAction<Void> removeReactionById(long messageId, @Nonnull Emoji emoji
|
2122 | 2119 | /**
|
2123 | 2120 | * This obtains the {@link net.dv8tion.jda.api.entities.User users} who reacted to a message using the given {@link Emoji}.
|
2124 | 2121 | *
|
| 2122 | + * <br>By default, this only includes users that reacted with {@link MessageReaction.ReactionType#NORMAL}. |
| 2123 | + * Use {@link #retrieveReactionUsersById(String, Emoji, MessageReaction.ReactionType) retrieveReactionUsersById(messageId, emoji, ReactionType.SUPER)} |
| 2124 | + * to retrieve the users that used a super reaction instead. |
| 2125 | + * |
2125 | 2126 | * <p>Messages maintain a list of reactions, alongside a list of users who added them.
|
2126 | 2127 | *
|
2127 | 2128 | * <p>Using this data, we can obtain a {@link ReactionPaginationAction ReactionPaginationAction}
|
@@ -2164,15 +2165,16 @@ default RestAction<Void> removeReactionById(long messageId, @Nonnull Emoji emoji
|
2164 | 2165 | @CheckReturnValue
|
2165 | 2166 | default ReactionPaginationAction retrieveReactionUsersById(@Nonnull String messageId, @Nonnull Emoji emoji)
|
2166 | 2167 | {
|
2167 |
| - Checks.isSnowflake(messageId, "Message ID"); |
2168 |
| - Checks.notNull(emoji, "Emoji"); |
2169 |
| - |
2170 |
| - return new ReactionPaginationActionImpl(this, messageId, emoji.getAsReactionCode()); |
| 2168 | + return retrieveReactionUsersById(messageId, emoji, MessageReaction.ReactionType.NORMAL); |
2171 | 2169 | }
|
2172 | 2170 |
|
2173 | 2171 | /**
|
2174 | 2172 | * This obtains the {@link net.dv8tion.jda.api.entities.User users} who reacted to a message using the given {@link Emoji}.
|
2175 | 2173 | *
|
| 2174 | + * <br>By default, this only includes users that reacted with {@link MessageReaction.ReactionType#NORMAL}. |
| 2175 | + * Use {@link #retrieveReactionUsersById(long, Emoji, MessageReaction.ReactionType) retrieveReactionUsersById(messageId, emoji, ReactionType.SUPER)} |
| 2176 | + * to retrieve the users that used a super reaction instead. |
| 2177 | + * |
2176 | 2178 | * <p>Messages maintain a list of reactions, alongside a list of users who added them.
|
2177 | 2179 | *
|
2178 | 2180 | * <p>Using this data, we can obtain a {@link ReactionPaginationAction ReactionPaginationAction}
|
@@ -2222,6 +2224,110 @@ default ReactionPaginationAction retrieveReactionUsersById(long messageId, @Nonn
|
2222 | 2224 | return retrieveReactionUsersById(Long.toUnsignedString(messageId), emoji);
|
2223 | 2225 | }
|
2224 | 2226 |
|
| 2227 | + /** |
| 2228 | + * This obtains the {@link net.dv8tion.jda.api.entities.User users} who reacted to a message using the given {@link Emoji}. |
| 2229 | + * |
| 2230 | + * <p>Messages maintain a list of reactions, alongside a list of users who added them. |
| 2231 | + * |
| 2232 | + * <p>Using this data, we can obtain a {@link ReactionPaginationAction ReactionPaginationAction} |
| 2233 | + * of the users who've reacted to the given message. |
| 2234 | + * |
| 2235 | + * <p>The following {@link net.dv8tion.jda.api.requests.ErrorResponse ErrorResponses} are possible: |
| 2236 | + * <ul> |
| 2237 | + * <li>{@link net.dv8tion.jda.api.requests.ErrorResponse#MISSING_ACCESS MISSING_ACCESS} |
| 2238 | + * <br>The retrieve request was attempted after the account lost access to the {@link GuildMessageChannel GuildMessageChannel} |
| 2239 | + * due to {@link net.dv8tion.jda.api.Permission#VIEW_CHANNEL Permission.VIEW_CHANNEL} being revoked |
| 2240 | + * <br>Also can happen if the account lost the {@link net.dv8tion.jda.api.Permission#MESSAGE_HISTORY Permission.MESSAGE_HISTORY}</li> |
| 2241 | + * |
| 2242 | + * <li>{@link net.dv8tion.jda.api.requests.ErrorResponse#UNKNOWN_EMOJI UNKNOWN_EMOJI} |
| 2243 | + * <br>The provided emoji was deleted, doesn't exist, or is not available to the currently logged-in account in this channel.</li> |
| 2244 | + * |
| 2245 | + * <li>{@link net.dv8tion.jda.api.requests.ErrorResponse#UNKNOWN_MESSAGE UNKNOWN_MESSAGE} |
| 2246 | + * <br>The provided {@code messageId} is unknown in this MessageChannel, either due to the id being invalid, or |
| 2247 | + * the message it referred to has already been deleted.</li> |
| 2248 | + * </ul> |
| 2249 | + * |
| 2250 | + * @param messageId |
| 2251 | + * The messageId to retrieve the users from. |
| 2252 | + * @param emoji |
| 2253 | + * The {@link Emoji} to retrieve users for. |
| 2254 | + * @param type |
| 2255 | + * The specific type of reaction |
| 2256 | + * |
| 2257 | + * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException |
| 2258 | + * If this is a {@link GuildMessageChannel GuildMessageChannel} and the |
| 2259 | + * logged in account does not have {@link net.dv8tion.jda.api.Permission#MESSAGE_HISTORY Permission.MESSAGE_HISTORY}. |
| 2260 | + * @throws java.lang.IllegalArgumentException |
| 2261 | + * <ul> |
| 2262 | + * <li>If provided {@code messageId} is {@code null} or not a valid snowflake.</li> |
| 2263 | + * <li>If provided {@code emoji} is {@code null}.</li> |
| 2264 | + * <li>If provided {@code type} is {@code null}.</li> |
| 2265 | + * </ul> |
| 2266 | + * |
| 2267 | + * @return The {@link ReactionPaginationAction} of the emoji's users. |
| 2268 | + */ |
| 2269 | + @Nonnull |
| 2270 | + @CheckReturnValue |
| 2271 | + default ReactionPaginationAction retrieveReactionUsersById(@Nonnull String messageId, @Nonnull Emoji emoji, @Nonnull MessageReaction.ReactionType type) |
| 2272 | + { |
| 2273 | + Checks.isSnowflake(messageId, "Message ID"); |
| 2274 | + Checks.notNull(emoji, "Emoji"); |
| 2275 | + Checks.notNull(type, "ReactionType"); |
| 2276 | + |
| 2277 | + return new ReactionPaginationActionImpl(this, messageId, emoji.getAsReactionCode(), type); |
| 2278 | + } |
| 2279 | + |
| 2280 | + /** |
| 2281 | + * This obtains the {@link net.dv8tion.jda.api.entities.User users} who reacted to a message using the given {@link Emoji}. |
| 2282 | + * |
| 2283 | + * <p>Messages maintain a list of reactions, alongside a list of users who added them. |
| 2284 | + * |
| 2285 | + * <p>Using this data, we can obtain a {@link ReactionPaginationAction ReactionPaginationAction} |
| 2286 | + * of the users who've reacted to the given message. |
| 2287 | + * |
| 2288 | + * <p>The following {@link net.dv8tion.jda.api.requests.ErrorResponse ErrorResponses} are possible: |
| 2289 | + * <ul> |
| 2290 | + * <li>{@link net.dv8tion.jda.api.requests.ErrorResponse#MISSING_ACCESS MISSING_ACCESS} |
| 2291 | + * <br>The retrieve request was attempted after the account lost access to the {@link GuildMessageChannel GuildMessageChannel} |
| 2292 | + * due to {@link net.dv8tion.jda.api.Permission#VIEW_CHANNEL Permission.VIEW_CHANNEL} being revoked |
| 2293 | + * <br>Also can happen if the account lost the {@link net.dv8tion.jda.api.Permission#MESSAGE_HISTORY Permission.MESSAGE_HISTORY}</li> |
| 2294 | + * |
| 2295 | + * <li>{@link net.dv8tion.jda.api.requests.ErrorResponse#UNKNOWN_EMOJI UNKNOWN_EMOJI} |
| 2296 | + * <br>The provided emoji was deleted, doesn't exist, or is not available to the currently logged-in account in this channel.</li> |
| 2297 | + * |
| 2298 | + * <li>{@link net.dv8tion.jda.api.requests.ErrorResponse#UNKNOWN_MESSAGE UNKNOWN_MESSAGE} |
| 2299 | + * <br>The provided {@code messageId} is unknown in this MessageChannel, either due to the id being invalid, or |
| 2300 | + * the message it referred to has already been deleted.</li> |
| 2301 | + * </ul> |
| 2302 | + * |
| 2303 | + * @param messageId |
| 2304 | + * The messageId to retrieve the users from. |
| 2305 | + * @param emoji |
| 2306 | + * The {@link Emoji} to retrieve users for. |
| 2307 | + * @param type |
| 2308 | + * The specific type of reaction |
| 2309 | + * |
| 2310 | + * @throws java.lang.UnsupportedOperationException |
| 2311 | + * If this is not a Received Message from {@link net.dv8tion.jda.api.entities.MessageType#DEFAULT MessageType.DEFAULT} |
| 2312 | + * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException |
| 2313 | + * If this is a {@link GuildMessageChannel GuildMessageChannel} and the |
| 2314 | + * logged in account does not have {@link net.dv8tion.jda.api.Permission#MESSAGE_HISTORY Permission.MESSAGE_HISTORY}. |
| 2315 | + * @throws java.lang.IllegalArgumentException |
| 2316 | + * <ul> |
| 2317 | + * <li>If provided {@code messageId} is not a valid snowflake.</li> |
| 2318 | + * <li>If provided {@code emoji} is {@code null}.</li> |
| 2319 | + * <li>If provided {@code type} is {@code null}.</li> |
| 2320 | + * </ul> |
| 2321 | + * |
| 2322 | + * @return The {@link ReactionPaginationAction ReactionPaginationAction} of the emoji's users. |
| 2323 | + */ |
| 2324 | + @Nonnull |
| 2325 | + @CheckReturnValue |
| 2326 | + default ReactionPaginationAction retrieveReactionUsersById(long messageId, @Nonnull Emoji emoji, @Nonnull MessageReaction.ReactionType type) |
| 2327 | + { |
| 2328 | + return retrieveReactionUsersById(Long.toUnsignedString(messageId), emoji, type); |
| 2329 | + } |
| 2330 | + |
2225 | 2331 | /**
|
2226 | 2332 | * Used to pin a message. Pinned messages are retrievable via {@link #retrievePinnedMessages()}.
|
2227 | 2333 | *
|
|
0 commit comments