Skip to content

Commit

Permalink
Build the User from data in the Interaction if the User was not cache…
Browse files Browse the repository at this point in the history
…d. (#2060)
  • Loading branch information
oliver276 committed Mar 25, 2022
1 parent 19e2b55 commit abf29a6
Showing 1 changed file with 11 additions and 1 deletion.
Expand Up @@ -23,6 +23,8 @@
import net.dv8tion.jda.internal.JDAImpl;
import net.dv8tion.jda.internal.entities.GuildImpl;
import net.dv8tion.jda.internal.entities.MemberImpl;
import net.dv8tion.jda.internal.entities.PrivateChannelImpl;
import net.dv8tion.jda.internal.entities.UserImpl;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
Expand Down Expand Up @@ -73,7 +75,15 @@ public InteractionImpl(JDAImpl jda, DataObject data)
);
}
this.channel = channel;
user = channel.getUser();

User user = channel.getUser();
if (user == null)
{
user = jda.getEntityBuilder().createUser(data.getObject("user"));
((PrivateChannelImpl) channel).setUser(user);
((UserImpl) user).setPrivateChannel(channel);
}
this.user = user;
}
}

Expand Down

0 comments on commit abf29a6

Please sign in to comment.