Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Catching send_temporary_message exceptions #232

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

arminherling
Copy link

Summary

I was trying to send an error message if my bot couldnt send a temporary message in a different channel and found a small bug in send_temporary_message.
Its currently not possible to catch exceptions because send_temporary_message creates the message in a different thread before deleting it after the timeout.

    begin
      different_channel.send_temporary_message content, 30
    rescue Discordrb::Errors::NoPermission => e
      next "No Permission!: #{e}"       # This branch never runs because we cant catch the exception currently
    end

Fixed

We can now catch the exception in user code

@arminherling
Copy link
Author

Would be nice if someone could review this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant