Przeglądaj źródła

Merge branch 'feature/blurse' of kirkleon/rollbot3 into master

kirkleon 6 lat temu
rodzic
commit
ed43e64944
1 zmienionych plików z 14 dodań i 2 usunięć
  1. 14 2
      src/plugins/curse.py

+ 14 - 2
src/plugins/curse.py

@@ -127,10 +127,13 @@ def curse(db, msg):
     return SUBC_MAP.get(subc, lambda *a: RollbotResponse(msg, failure=RollbotFailure.INVALID_SUBCOMMAND))(db, msg, args)
 
 
-class bless(RollbotPlugin):
+class Bless(RollbotPlugin):
     def __init__(self, bot, logger=logging.getLogger(__name__)):
         RollbotPlugin.__init__(self, "bless", bot, logger=logger)
 
+    def do_score_change(self, score):
+        score.blessings = score.blessings + 1
+
     def on_command(self, db, msg):
         name, _ = pop_arg(msg.raw_args)
         if name.startswith("!"):
@@ -140,5 +143,14 @@ class bless(RollbotPlugin):
             self.bot.manually_post_message("Hey! You aren't allowed to affect that person's score! And cheaters never propser!", msg.group_id)
             return RollbotResponse(msg, txt=f"!curse {BAN_LIST[msg.sender_id][0]} for trying to bless someone they can't!")
         score = get_score(db, msg.group_id, person_id)
-        score.blessings = score.blessings + 1
+        self.do_score_change(score)
         return get_response(msg, name, score)
+
+
+class Blurse(Bless):
+    def __init__(self, bot, logger=logging.getLogger(__name__)):
+        RollbotPlugin.__init__(self, "blurse", bot, logger=logger)
+
+    def do_score_change(self, score):
+        score.blessings = score.blessings + 1
+        score.curses = score.curses + 1