-
-
Notifications
You must be signed in to change notification settings - Fork 738
Abbreviate codeblock instructions; remove ability to dismiss the inst… #3232
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,9 +37,8 @@ def _get_bad_ticks_message(code_block: _parsing.CodeBlock) -> str | None: | |
|
|
||
| valid_ticks = f"\\{_parsing.BACKTICK}" * 3 | ||
| instructions = ( | ||
| "It looks like you are trying to paste code into this channel.\n\n" | ||
| "You seem to be using the wrong symbols to indicate where the code block should start. " | ||
| f"The correct symbols would be {valid_ticks}, not `{code_block.tick * 3}`." | ||
| "You are using the wrong character instead of backticks. " | ||
| f"Use {valid_ticks}, not `{code_block.tick * 3}`." | ||
| ) | ||
|
|
||
| log.trace("Check if the bad ticks code block also has issues with the language specifier.") | ||
|
|
@@ -59,8 +58,6 @@ def _get_bad_ticks_message(code_block: _parsing.CodeBlock) -> str | None: | |
| instructions += "\n\nFurthermore, " + addition_msg[0].lower() + addition_msg[1:] | ||
| else: | ||
| log.trace("No issues with the language specifier found.") | ||
| example_blocks = _get_example(code_block.language) | ||
| instructions += f"\n\n**Here is an example of how it should look:**\n{example_blocks}" | ||
|
|
||
| return instructions | ||
|
|
||
|
|
@@ -71,13 +68,7 @@ def _get_no_ticks_message(content: str) -> str | None: | |
|
|
||
| if _parsing.is_python_code(content): | ||
| example_blocks = _get_example("py") | ||
| return ( | ||
| "It looks like you're trying to paste code into this channel.\n\n" | ||
| "Discord has support for Markdown, which allows you to post code with full " | ||
| "syntax highlighting. Please use these whenever you paste code, as this " | ||
| "helps improve the legibility and makes it easier for us to help you.\n\n" | ||
| f"**To do this, use the following method:**\n{example_blocks}" | ||
| ) | ||
| return example_blocks | ||
| log.trace("Aborting missing code block instructions: content is not Python code.") | ||
| return None | ||
|
|
||
|
|
@@ -135,12 +126,8 @@ def _get_no_lang_message(content: str) -> str | None: | |
| example_blocks = _get_example("py") | ||
|
|
||
| # Note that _get_bad_ticks_message expects the first line to have two newlines. | ||
| return ( | ||
| "It looks like you pasted Python code without syntax highlighting.\n\n" | ||
| "Please use syntax highlighting to improve the legibility of your code and make " | ||
| "it easier for us to help you.\n\n" | ||
| f"**To do this, use the following method:**\n{example_blocks}" | ||
| ) | ||
| return f"Please add a `py` after the three backticks.\n\n{example_blocks}" | ||
|
|
||
| log.trace("Aborting missing language instructions: content is not Python code.") | ||
| return None | ||
|
|
||
|
|
@@ -177,7 +164,4 @@ def get_instructions(content: str) -> str | None: | |
| if not instructions: | ||
| instructions = _get_no_lang_message(block.content) | ||
|
|
||
| if instructions: | ||
| instructions += "\nYou can **edit your original message** to correct your code block." | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you think this line was ineffective? The intent was to avoid spamming the channel with several attempts to fix their message. I don't know a better way to communicate this.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I moved this instruction to the title for the embed.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I need to read more carefully, sorry!
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No problem; thank you for having written the original code in such a way that the changes in this PR were straightforward to make. |
||
|
|
||
| return instructions | ||
Uh oh!
There was an error while loading. Please reload this page.