|
@@ -106,10 +106,11 @@ BAN_LIST = get_secret("curse.banlist")
|
|
|
|
|
|
|
|
|
@as_plugin
|
|
|
-def curse(db, msg):
|
|
|
- # TODO might be nice to add subcommands to this later
|
|
|
- name, args = pop_arg(msg.raw_args)
|
|
|
- if not name.startswith("!"):
|
|
|
+def curse(db, msg, subc):
|
|
|
+ if subc is None:
|
|
|
+ name, _ = pop_arg(msg.raw_args)
|
|
|
+ if name is None:
|
|
|
+ return "Sorry - you need to provide the name of someone to curse!"
|
|
|
person_id = name.strip().lower()
|
|
|
if is_banned(msg, person_id):
|
|
|
if msg.sender_id in get_secret("curse.nolist"):
|
|
@@ -120,14 +121,7 @@ def curse(db, msg):
|
|
|
score.curses = score.curses + 1
|
|
|
return get_response(msg, name, score)
|
|
|
|
|
|
- # strip off the '!'
|
|
|
- subc = name[1:].strip()
|
|
|
- if len(subc) == 0:
|
|
|
- # handle the case of spaces between ! and subcommand
|
|
|
- subc, args = pop_arg(args)
|
|
|
- subc = subc.lower()
|
|
|
-
|
|
|
- return SUBC_MAP.get(subc, lambda *a: RollbotResponse(msg, failure=RollbotFailure.INVALID_SUBCOMMAND))(db, msg, args)
|
|
|
+ return SUBC_MAP.get(subc.command, lambda *_: RollbotResponse(msg, failure=RollbotFailure.INVALID_SUBCOMMAND))(db, msg, subc.raw_args)
|
|
|
|
|
|
|
|
|
class Bless(RollbotPlugin):
|
|
@@ -140,7 +134,7 @@ class Bless(RollbotPlugin):
|
|
|
def on_command(self, db, msg):
|
|
|
name, _ = pop_arg(msg.raw_args)
|
|
|
if name.startswith("!"):
|
|
|
- return "Sorry! Subcommands have to go on !curse for now - this will be fixed in the future!"
|
|
|
+ return RollbotResponse(msg, txt="Sorry! Subcommands have to go on !curse for now - this will be fixed in the future!")
|
|
|
person_id = name.strip().lower()
|
|
|
if is_banned(msg, person_id):
|
|
|
self.bot.manually_post_message("Hey! You aren't allowed to affect that person's score! And cheaters never propser!", msg.group_id)
|