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

feat/bcrypt: add bcrypt command #201

Merged
merged 5 commits into from
Oct 12, 2023
Merged

feat/bcrypt: add bcrypt command #201

merged 5 commits into from
Oct 12, 2023

Conversation

zqwirp
Copy link
Contributor

@zqwirp zqwirp commented Oct 5, 2023

I've added the requested bcrypt command as explained in the issue. The /bcrypt command deletes the command and sends the hashed result of the command argument to the chat.

Please review the PR and let me know if anything needs to be added or adjusted.

@codecov
Copy link

codecov bot commented Oct 5, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (4e6dd17) 78.93% compared to head (63aad3d) 78.93%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #201   +/-   ##
=======================================
  Coverage   78.93%   78.93%           
=======================================
  Files          26       26           
  Lines        1619     1619           
=======================================
  Hits         1278     1278           
  Misses        341      341           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@aldy505
Copy link
Member

aldy505 commented Oct 8, 2023

Is this still a draft, or ready to review?

@zqwirp zqwirp marked this pull request as ready for review October 9, 2023 02:11
@zqwirp
Copy link
Contributor Author

zqwirp commented Oct 9, 2023

Is this still a draft, or ready to review?

ready for review

Comment on lines 12 to 13
const salt = bc.genSaltSync(10);
const hashedText = bc.hashSync(text, salt);
Copy link
Member

Choose a reason for hiding this comment

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

are there any reasons behind the use of the sync version instead of its async counterpart?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

just to write simple code

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if bc.genSaltSync(10) is any simpler than just doing await bc.genSalt(10)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

got it, i'll update it to use await bc.genSalt(10)

@aldy505 aldy505 requested a review from elianiva October 12, 2023 10:04
@lamualfa lamualfa merged commit d342415 into teknologi-umum:master Oct 12, 2023
4 checks passed
@aldy505
Copy link
Member

aldy505 commented Oct 13, 2023

Hi @zqwirp! Your bcrypt implementation causes an error that makes the bot keeps restarting over and over again.

You can find the detail of the error here: https://teknologi-umum.sentry.io/share/issue/34a257c81f3c45a1b28b7b36aa1301b4/

On production, we're using Docker as defined on the Dockerfile (you can see it here https://github.com/teknologi-umum/bot/blob/master/Dockerfile). Any inputs are welcome.

@WahidinAji
Copy link
Contributor

is it possible to revert this PR and let the existing command work as usual? ^-^

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.

5 participants