Skip to content

Cannot open PrivateChannel when reviewing QOTW #539

Description

@danthe1st
  1. Describe the bug
    When a QOTW submission is reviewed with the submission author not allowing DMs from the bot, the following exception occurs:
ForkJoinPool.commonPool-worker-668            UserNotificatio ERROR  Could not open PrivateChannel with user <REDACTED>
net.dv8tion.jda.api.exceptions.ErrorResponseException: 50007: Cannot send messages to this user
        at net.dv8tion.jda.api.requests.Request.createErrorResponseException(Request.java:156)
        at net.dv8tion.jda.internal.requests.RestActionImpl.handleResponse(RestActionImpl.java:297)
        at net.dv8tion.jda.api.requests.Request.handleResponse(Request.java:290)
        at net.dv8tion.jda.internal.requests.Requester$WorkTask.handleResponse(Requester.java:413)
        at net.dv8tion.jda.internal.requests.Requester$WorkTask.access$300(Requester.java:360)
        at net.dv8tion.jda.internal.requests.Requester.execute(Requester.java:241)
        at net.dv8tion.jda.internal.requests.Requester.execute(Requester.java:156)
        at net.dv8tion.jda.internal.requests.Requester.execute(Requester.java:140)
        at net.dv8tion.jda.internal.requests.Requester$WorkTask.execute(Requester.java:383)
        at net.dv8tion.jda.api.requests.SequentialRestRateLimiter$Bucket.execute(SequentialRestRateLimiter.java:468)
        at net.dv8tion.jda.api.requests.SequentialRestRateLimiter$Bucket.run(SequentialRestRateLimiter.java:514)
        at java.base@25.0.2/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1090)
        at java.base@25.0.2/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:614)
        at java.base@25.0.2/java.lang.Thread.runWith(Thread.java:1487)
        at java.base@25.0.2/java.lang.Thread.run(Thread.java:1474)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:832)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:808)
Caused by: net.dv8tion.jda.api.exceptions.ContextException
        at net.dv8tion.jda.internal.requests.restaction.operator.RestActionOperator.contextWrap(RestActionOperator.java:119)
        at net.dv8tion.jda.internal.requests.restaction.operator.FlatMapRestAction.queue(FlatMapRestAction.java:50)
        at net.discordjug.javabot.systems.notification.UserNotificationService.sendDirectMessage(UserNotificationService.java:35)
        at net.discordjug.javabot.systems.notification.QOTWNotificationService.sendAccountIncrementedNotification(QOTWNotificationService.java:51)
        at net.discordjug.javabot.systems.qotw.submissions.SubmissionManager.acceptSubmission(SubmissionManager.java:204)
        at net.discordjug.javabot.systems.qotw.submissions.SubmissionManager.lambda$handleSelectReview$0(SubmissionManager.java:136)
        at net.dv8tion.jda.api.requests.Request.lambda$onSuccess$0(Request.java:131)
        at java.base@25.0.2/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.compute(ForkJoinTask.java:1750)
        at java.base@25.0.2/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.compute(ForkJoinTask.java:1742)
        at java.base@25.0.2/java.util.concurrent.ForkJoinTask$InterruptibleTask.exec(ForkJoinTask.java:1659)
        at java.base@25.0.2/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:511)
        at java.base@25.0.2/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1450)
        at java.base@25.0.2/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:2019)
        at java.base@25.0.2/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:187)
        ... 2 common frames omitted
  1. Steps to reproduce
  • Configure the bot for QOTW
  • Add a new QOTW question
  • Start the QOTW
  • Answer the QOTW
  • Make sure the user answering the QOTW has DMs disabled
  • Close the QOTW
  • Review the QOTW.
  1. Expected behavior
    The bot shouldn't log the exception when it cannot open a DM channel.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions