class Slap(Worker):
- binding_keys = ["nick.slap.#"]
- description = "slap people"
+ binding_keys = ["nick.slap.#", "nick.hug.#"]
+ description = "slap/hug people"
def parse_body(self, msg):
sender = get_nick_from_message(msg)
- if len(self.used_channel) > 2:
- slapped = " ".join(self.used_channel[2:])
+ w = get_words(msg)
+ verb = w[0] + 's'
+ if len(w) > 1:
+ subject = " ".join(w[1:])
else:
- slapped = sender
- return Action(msg='/me slaps {}'.format(slapped))
-
-
-class Hug(Worker):
- binding_keys = ["nick.hug.#"]
- description = "hugs people"
-
- def parse_body(self, msg):
- sender = get_nick_from_message(msg)
- if len(self.used_channel) > 2:
- slapped = " ".join(self.used_channel[2:])
- else:
- slapped = sender
- return Action(msg='/me hugs {}'.format(slapped))
+ subject = sender
+ return Action(msg=f'/me {verb} {subject}')
class Consumables(Worker):
return Action(msg="ELIMINATE! ELIMINATE!")
-ALL = [Klammer, Terminate, Unicode, Hug, Slap, Consumables, MentalDeficits, Selfreaction, Doctor]
+ALL = [Klammer, Terminate, Unicode, Slap, Consumables, MentalDeficits, Selfreaction, Doctor]