Skip to content

Commit b3a4574

Browse files
authored
Merge pull request #140 from python-discord/vivek/smarte
Add PEP 9001 Zen of python response
2 parents 4da3ea8 + c5e7484 commit b3a4574

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

bot/exts/smart_eval/_smart_eval_rules.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from bot.exts.miscellaneous import ZEN_OF_PYTHON
2+
13
# If you want to capture something that will be used in the response, capture it with a named group called "content"
24

35
RULES = {
@@ -41,9 +43,12 @@
4143
"Semicolons do not belong in Python code",
4244
"You say this is Python, but the presence of a semicolon makes me think otherwise.",
4345
],
44-
r"\b(:?foo|bar|baz)\b": [ # Detect boring metasyntactic variables
46+
r"\b(?:foo|bar|baz)\b": [ # Detect boring metasyntactic variables
4547
"foo, bar, and baz are boring - use spam, ham, and eggs instead.",
46-
]
48+
],
49+
r"(?m:^\s*import\s+this\s*$)": [ # Detect use of "import this"
50+
f"```\n{ZEN_OF_PYTHON}```",
51+
],
4752
}
4853

4954
DEFAULT_RESPONSES = [

0 commit comments

Comments
 (0)