Skip to content

Changes breaking text in congrats-bot.mjs script #1653

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

Merged
merged 2 commits into from
Oct 1, 2022

Conversation

Lofty-Brambles
Copy link
Contributor

@Lofty-Brambles Lofty-Brambles commented Sep 30, 2022

What kind of changes does this PR include?

  • Something else!
  • Replaces the message breaking -- with –– instead, as to not break discord markdown.

Description

@netlify
Copy link

netlify bot commented Sep 30, 2022

Deploy Preview for astro-docs-2 ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit f567324
🔍 Latest deploy log https://app.netlify.com/sites/astro-docs-2/deploys/6337c1ad1cf76c00086e5283
😎 Deploy Preview https://deploy-preview-1653--astro-docs-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@@ -9,7 +9,7 @@ setDiscordMessage(COMMIT_AUTHOR, COMMIT_ID, COMMIT_MESSAGE);
* @param {string} commitMsg A full commit message
*/
function setDiscordMessage(author, id, commitMsg) {
const commitMessage = commitMsg.split('\n').shift().replaceAll('`', '');
const commitMessage = commitMsg.split('\n').shift().replaceAll('`', '').replaceAll('--', '––');
Copy link
Member

Choose a reason for hiding this comment

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

Interesting. Didn’t think of this approach!

I think we can even go one better:

Suggested change
const commitMessage = commitMsg.split('\n').shift().replaceAll('`', '').replaceAll('--', '––');
const commitMessage = commitMsg.split('\n').shift().replaceAll('`', '').replaceAll('--', '-​-');

Very hard to see, but I’ve added a zero-width space between the two hyphens. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds like an even smoother approach! Added it!
The only worry is discord might not read it as a character, but from my test, it seems to.

@delucis delucis added the hacktoberfest-accepted Mark a PR as accepted to contribute towards Hacktoberfest label Oct 1, 2022
Copy link
Member

@delucis delucis left a comment

Choose a reason for hiding this comment

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

Thanks! Lucky we have a PR open at the moment that we can test this with when it merges, so I'll get this merged now and we can revisit if there any problems.

Welcome to Team Docs @Lofty-Brambles!

@delucis delucis merged commit cfb16f6 into withastro:main Oct 1, 2022
nokazn pushed a commit to nokazn/docs.astro.build that referenced this pull request Oct 2, 2022
* Escapes breaking text in congrats-bot.mjs script

* Change escaping method with zero-width space

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted Mark a PR as accepted to contribute towards Hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Escape --flags in Discord CongratsBot
2 participants