From: Thorsten Date: Sat, 29 Feb 2020 10:57:01 +0000 (+0100) Subject: hugfix X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=17f5316f17fbd43007bcfc501477b4b1084835d9;p=urlbot-v3.git hugfix --- diff --git a/distbot/plugins/fun.py b/distbot/plugins/fun.py index bf6fe87..9d8a795 100644 --- a/distbot/plugins/fun.py +++ b/distbot/plugins/fun.py @@ -54,29 +54,18 @@ class Unicode(Worker): 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): @@ -184,4 +173,4 @@ class Doctor(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]