|
@@ -1,5 +1,9 @@
|
|
|
+import re
|
|
|
+
|
|
|
from rollbot import as_command, initialize_data, RollbotFailure, Message, Context
|
|
|
-from rollbot.injection import Data, Args, Lazy, Injector
|
|
|
+from rollbot.injection import Data, Args, Injector
|
|
|
+
|
|
|
+for_pattern = re.compile(r"\bfor\b")
|
|
|
|
|
|
|
|
|
@initialize_data
|
|
@@ -8,7 +12,7 @@ class CurseScore:
|
|
|
zero_passes: int = 0
|
|
|
|
|
|
def touch(self):
|
|
|
- if self.score == 0:
|
|
|
+ if abs(self.score) <= 1:
|
|
|
self.zero_passes += 1
|
|
|
|
|
|
def __str__(self):
|
|
@@ -18,7 +22,7 @@ class CurseScore:
|
|
|
class Target(Injector[str]):
|
|
|
async def inject(self, message: Message, context: Context) -> str:
|
|
|
args = await Args.inject(message, context)
|
|
|
- key = args.rsplit("for", maxsplit=1)[0].strip().replace(" ", "_").lower()
|
|
|
+ key = re.split(for_pattern, args, maxsplit=1)[0].strip().replace(" ", "_").lower()
|
|
|
if key == "":
|
|
|
RollbotFailure.INVALID_ARGUMENTS.raise_exc(
|
|
|
detail="I need to know who or what you're trying to curse!"
|