Skip to content

Commit

Permalink
Fix commands not working in some DMs
Browse files Browse the repository at this point in the history
isBot is sometimes null and causes an exception. Now assume it's false
in those cases. Seems to be the proper way, though not sure why it
mostly worked without this - from my own tests Discord always skips the
bot field unless it's true.
  • Loading branch information
jedenastka committed Oct 2, 2024
1 parent 4ce3808 commit 1179c38
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ public void loadPatches(Context context) throws Throwable {
var channelType = channel.D();
if (channelType == Channel.DM) {
var user = channel.z().get(0);
var userIsBot = user.e();
var userIsBot = Optional.ofNullable(user.e())
.orElse(false);
if (userIsBot) {
var channelId = channel.k();
applicationIndexSource = Optional.of(new ApplicationIndexSourceDm(channelId));
Expand Down

0 comments on commit 1179c38

Please sign in to comment.