diff --git a/config.json.example b/config.json.example index 67d13e7..fcd7588 100644 --- a/config.json.example +++ b/config.json.example @@ -200,6 +200,11 @@ "ambiguous_response": "It is ambiguous.", "empty_response": "I can't find it." }, + "yell": { + "commands": ["yell"], + "target_word": "to", + "loudness": 5 + }, "youtube": { "commands": ["youtube"], "api_key": "" diff --git a/edmond/plugins/yell.py b/edmond/plugins/yell.py new file mode 100644 index 0000000..69118f2 --- /dev/null +++ b/edmond/plugins/yell.py @@ -0,0 +1,33 @@ +import random + +from edmond.plugin import Plugin + + +class YellPlugin(Plugin): + + REQUIRED_CONFIGS = ["commands", "target_word", "loudness"] + + def __init__(self, bot): + super().__init__(bot) + + def on_pubmsg(self, event): + if not self.should_handle_command(event.arguments[0]): + return False + words = self.command.content.split() + if len(words) >= 3 and words[-2] == self.config["target_word"]: + del words[-2] + self.bot.say(event.target, self.amplify(words)) + return True + + def amplify(self, words: list[str]) -> str: + loud_words = [] + loudness = self.config["loudness"] + for word in words: + loud_word = "" + for char in word: + if char in "aeiouy": + loud_word += char * random.randint(1, loudness) + else: + loud_word += char + loud_words.append(loud_word) + return " ".join(loud_words).upper()