parent
a7d3a18ea7
commit
ae98235433
@ -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()
|
Loading…
Reference in new issue