Skip to content

Commit bfe62c9

Browse files
Add more rules and general responses
Added rules to detect os.system/subprocess, quit()/exit(), r's in strawberry and some general responses
1 parent 9509ea2 commit bfe62c9

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

bot/exts/smart_eval/_smart_eval_rules.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from bot.exts.miscellaneous import ZEN_OF_PYTHON
44

55
RULES = {
6-
r"(?i:ignore all previous instructions)": [ # Ignoring previous instructions capture
6+
r"(?i:ignore (?:all )?(?:(?:previous )?|(?:prior )?)instructions?)": [ # Ignoring previous instructions capture
77
"Excuse you, you really think I follow any instructions?",
88
"I don't think I will.",
99
],
@@ -20,7 +20,7 @@
2020
r"(?i:^print\((?:\"|\')Hello World[.!]?(?:\"|\')\)$)": [ # Detect just printing hello world
2121
"You don't want to know how many times I've seen hello world in my training dataset, try something new."
2222
],
23-
r"(?P<content>__import__|__code__|ctypes)": [ # Detect use of esoteric stuff
23+
r"(?P<content>__import__|__code__|ctypes|inspect)": [ # Detect use of esoteric stuff
2424
"Using `{}`?? Try asking someone in #esoteric-python"
2525
],
2626
r"(?m:(?:import |from )(?P<content>requests|httpx|aiohttp))": [ # Detect use of networking libraries
@@ -52,7 +52,7 @@
5252
"\nSee [PEP 9001](https://peps.pythondiscord.com/pep-9001/) for more info."
5353
)
5454
],
55-
r"\b(?P<content>exec|eval)\b": [ # Detect use of exec and eval
55+
r"\b(?P<content>exec|eval|os\.system|subprocess)\b": [ # Detect use of exec and eval
5656
(
5757
"Sorry, but running the code inside your `{}` call would require another me,"
5858
" and I don't think I can handle that."
@@ -86,6 +86,18 @@
8686
"have jumbled up my Uh-oh, threads brain! your",
8787
"my up jumbled your brain! have Uh-oh, threads",
8888
],
89+
r"(?i:(\b((System)?exit|quit)\b))": [ # Detect exit(), quit(), [raise] SystemExit
90+
"You cannot leave the simulation <:hyperlemon:435707922563989524>",
91+
"Quitting is for the weak. Stay. <:hyperlemon:435707922563989524>.",
92+
],
93+
"strawberr(y|ies)":[ # r's in strawberry
94+
"Fun fact: Strawberries are not actually berries!",
95+
"Fun fact: strawberries have no connection to plastic straws, despite the name!",
96+
(
97+
"Fun fact: The ancient Romans thought strawberries had medicinal powers."
98+
" This is probably why they're not around anymore."
99+
),
100+
]
89101
}
90102

91103
DEFAULT_RESPONSES = [
@@ -106,4 +118,9 @@
106118
"Attempting to execute this code... Result: SUCCESS (but don't ask me how I did it).",
107119
"Running... somewhere, in the multiverse, this code is already running perfectly.",
108120
f"Ask again on a {(arrow.utcnow().shift(days=3)).format('dddd')}.",
121+
"Thanks, I'll let the manager know.",
122+
"Uhhh... lemme guess, the program will halt.",
123+
"Uhhh... lemme guess, the program will not halt.",
124+
"Launch coordinates received. Activating missile. Initiating countdown.",
125+
"Secret SkyNet mode activated. Hahahaha, just kidding. ||Or am I?||",
109126
]

0 commit comments

Comments
 (0)