Skip to content

add error handing for cases where user leaves before timeout ends#52

Merged
AdamT20054 merged 1 commit intoAdamT20054:mainfrom
KosmicDaKerbal:main
Jan 4, 2026
Merged

add error handing for cases where user leaves before timeout ends#52
AdamT20054 merged 1 commit intoAdamT20054:mainfrom
KosmicDaKerbal:main

Conversation

@KosmicDaKerbal
Copy link
Contributor

Description

Added some error handling for an edge case that appeared in my discord bot.



Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Steps to replicate bug:
Present captcha
once captcha is presented in DM, leave server
after timeout is reached, the bot tries to send the captcha fail message, but it fails because user is not in the server anymore, which throws an API exception.

Solution: Adding a try{} catch{} block in the message.send method which will tell whether the user has left the server or whether kicking the user has failed

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for opening your first pull request! Make sure you include a brief explanation for any changes you've made (if the code is not commented)

@AdamT20054 AdamT20054 self-assigned this Jan 4, 2026
@AdamT20054 AdamT20054 added the enhancement New feature or request label Jan 4, 2026
@AdamT20054
Copy link
Owner

Thanks for the PR!

Didn't know people were still using this. I'll hopefully revisit it some time in the next few weeks and update it to whatever DJS version is the latest now :)

@AdamT20054 AdamT20054 merged commit ed6d418 into AdamT20054:main Jan 4, 2026
2 checks passed
@AdamT20054
Copy link
Owner

Please give me a moment to push the changes to npm

@KosmicDaKerbal
Copy link
Contributor Author

Thanks for the PR!

Didn't know people were still using this. I'll hopefully revisit it some time in the next few weeks and update it to whatever DJS version is the latest now :)

I'll love it if you can. Currently I'm facing issues with installing it in my project. The original discord.js-captcha library is working.

image

@AdamT20054
Copy link
Owner

Thanks for the PR!
Didn't know people were still using this. I'll hopefully revisit it some time in the next few weeks and update it to whatever DJS version is the latest now :)

I'll love it if you can. Currently I'm facing issues with installing it in my project. The original discord.js-captcha library is working.
image

Please can you pull the latest package from npm and let me know. the WARNs are fine for now.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants