@@ -37,9 +37,8 @@ def _get_bad_ticks_message(code_block: _parsing.CodeBlock) -> str | None:
37
37
38
38
valid_ticks = f"\\ { _parsing .BACKTICK } " * 3
39
39
instructions = (
40
- "It looks like you are trying to paste code into this channel.\n \n "
41
- "You seem to be using the wrong symbols to indicate where the code block should start. "
42
- f"The correct symbols would be { valid_ticks } , not `{ code_block .tick * 3 } `."
40
+ "You are using the wrong character instead of backticks. "
41
+ f"Use { valid_ticks } , not `{ code_block .tick * 3 } `."
43
42
)
44
43
45
44
log .trace ("Check if the bad ticks code block also has issues with the language specifier." )
@@ -53,14 +52,12 @@ def _get_bad_ticks_message(code_block: _parsing.CodeBlock) -> str | None:
53
52
log .trace ("Language specifier issue found; appending additional instructions." )
54
53
55
54
# The first line has double newlines which are not desirable when appending the msg.
56
- addition_msg = addition_msg .replace ("\n \n " , " " , 1 )
55
+ addition_msg = addition_msg .replace ("\n \n " , " " , 1 ). strip ()
57
56
58
57
# Make the first character of the addition lower case.
59
- instructions += "\n \n Furthermore , " + addition_msg [0 ].lower () + addition_msg [1 :]
58
+ instructions += "\n \n Also , " + addition_msg [0 ].lower () + addition_msg [1 :]
60
59
else :
61
60
log .trace ("No issues with the language specifier found." )
62
- example_blocks = _get_example (code_block .language )
63
- instructions += f"\n \n **Here is an example of how it should look:**\n { example_blocks } "
64
61
65
62
return instructions
66
63
@@ -71,13 +68,7 @@ def _get_no_ticks_message(content: str) -> str | None:
71
68
72
69
if _parsing .is_python_code (content ):
73
70
example_blocks = _get_example ("py" )
74
- return (
75
- "It looks like you're trying to paste code into this channel.\n \n "
76
- "Discord has support for Markdown, which allows you to post code with full "
77
- "syntax highlighting. Please use these whenever you paste code, as this "
78
- "helps improve the legibility and makes it easier for us to help you.\n \n "
79
- f"**To do this, use the following method:**\n { example_blocks } "
80
- )
71
+ return example_blocks
81
72
log .trace ("Aborting missing code block instructions: content is not Python code." )
82
73
return None
83
74
@@ -115,10 +106,8 @@ def _get_bad_lang_message(content: str) -> str | None:
115
106
example_blocks = _get_example (language )
116
107
117
108
# Note that _get_bad_ticks_message expects the first line to have two newlines.
118
- return (
119
- f"It looks like you incorrectly specified a language for your code block.\n \n { lines } "
120
- f"\n \n **Here is an example of how it should look:**\n { example_blocks } "
121
- )
109
+ return f"\n \n { lines } \n \n **Here is an example of how it should look:**\n { example_blocks } "
110
+
122
111
log .trace ("Nothing wrong with the language specifier; no instructions to return." )
123
112
return None
124
113
@@ -135,12 +124,8 @@ def _get_no_lang_message(content: str) -> str | None:
135
124
example_blocks = _get_example ("py" )
136
125
137
126
# Note that _get_bad_ticks_message expects the first line to have two newlines.
138
- return (
139
- "It looks like you pasted Python code without syntax highlighting.\n \n "
140
- "Please use syntax highlighting to improve the legibility of your code and make "
141
- "it easier for us to help you.\n \n "
142
- f"**To do this, use the following method:**\n { example_blocks } "
143
- )
127
+ return f"\n \n Add a `py` after the three backticks.\n \n { example_blocks } "
128
+
144
129
log .trace ("Aborting missing language instructions: content is not Python code." )
145
130
return None
146
131
@@ -177,7 +162,4 @@ def get_instructions(content: str) -> str | None:
177
162
if not instructions :
178
163
instructions = _get_no_lang_message (block .content )
179
164
180
- if instructions :
181
- instructions += "\n You can **edit your original message** to correct your code block."
182
-
183
165
return instructions
0 commit comments