This repository was archived by the owner on Jun 9, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
src/main/java/com/mewna/catnip/shard Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -222,6 +222,16 @@ private void emit0(@Nonnull final JsonObject payload) {
222
222
if (data .has ("user" )) {
223
223
final var user = catnip .entityBuilder ().createUser (data .getObject ("user" ));
224
224
catnip .cacheWorker ().bulkCacheUsers (payload .getObject ("shard" ).getInt ("id" ), List .of (user ));
225
+ final var discrim = Integer .parseInt (user .discriminator ());
226
+ if (discrim < 1 || discrim > 9999 ) {
227
+ final JsonObject clone = new JsonObject (payload );
228
+ // catnip-internal key
229
+ clone .remove ("shard" );
230
+ catnip .logAdapter ().warn ("Received a presence update for a user with a discriminator of '{}', " +
231
+ "but we should never get this. Discriminators should be clamped to [0001, 9999]." +
232
+ "If you report this to Discord, include the following JSON in your report:\n {}" ,
233
+ discrim , JsonUtil .encodePrettily (clone ));
234
+ }
225
235
}
226
236
if (catnip .cacheWorker ().canProvidePreviousState (MEMBER )) {
227
237
catnip .cache ().member (partialMember .guildIdAsLong (), partialMember .idAsLong ())
You can’t perform that action at this time.
0 commit comments