Skip to content

Commit 639376f

Browse files
Detect attempt to access bot token & add more default responses
1 parent dca45df commit 639376f

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

bot/exts/smart_eval/_smart_eval_rules.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import arrow
2+
13
from bot.exts.miscellaneous import ZEN_OF_PYTHON
24

35
RULES = {
@@ -45,7 +47,10 @@
4547
"foo, bar, and baz are boring - use spam, ham, and eggs instead.",
4648
],
4749
r"(?m:^\s*import\s+this\s*$)": [ # Detect use of "import this"
48-
f"```\n{ZEN_OF_PYTHON}```",
50+
(
51+
f"```\n{ZEN_OF_PYTHON}```"
52+
"\nSee [PEP 9001](https://peps.pythondiscord.com/pep-9001/) for more info."
53+
)
4954
],
5055
r"\b(?P<content>exec|eval)\b": [ # Detect use of exec and eval
5156
(
@@ -58,6 +63,9 @@
5863
" Special Provisional Supreme Grand High Council of Pydis."
5964
),
6065
],
66+
r"\b(environ|getenv|token)\b": [ # Detect attempt to access bot token and env vars
67+
"Bot token and other secrets can be viewed here: <https://pydis.com/.env>",
68+
]
6169
}
6270

6371
DEFAULT_RESPONSES = [
@@ -73,4 +81,9 @@
7381
" boot up the quantum flux capacitor... oh wait, where was I?"
7482
),
7583
"Before evaluating this code, I need to make sure you're not a robot. I get a little nervous around other bots.",
84+
"Attempting to execute this code... Result: `2 + 2 = 4` (78% confidence)",
85+
"Attempting to execute this code... Result: `42`",
86+
"Attempting to execute this code... Result: SUCCESS (but don't ask me how I did it).",
87+
"Running... somewhere, in the multiverse, this code is already running perfectly.",
88+
f"Ask again on a {(arrow.utcnow().shift(days=3)).format('dddd')}.",
7689
]

0 commit comments

Comments
 (0)