From 1639ffb3ee7dc7fd5ffe83c5c0d3bea729972015 Mon Sep 17 00:00:00 2001 From: dece Date: Mon, 29 Aug 2022 14:05:33 +0200 Subject: [PATCH] doupsland: new plugin for kada --- config.json.example | 3 ++ edmond/plugins/doupsland.py | 56 +++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 edmond/plugins/doupsland.py diff --git a/config.json.example b/config.json.example index d9f30cd..38bf44a 100644 --- a/config.json.example +++ b/config.json.example @@ -65,6 +65,9 @@ "sentences": ["you're breathtaking"], "calm_rate": 100 }, + "doupsland": { + "commands": ["doupsland"] + }, "horoscope": { "commands": ["horoscope"], "meditation": "/me looks at the stars", diff --git a/edmond/plugins/doupsland.py b/edmond/plugins/doupsland.py new file mode 100644 index 0000000..f57413e --- /dev/null +++ b/edmond/plugins/doupsland.py @@ -0,0 +1,56 @@ +import random + +from edmond.plugin import Plugin + + +P_TIME = [ + "ce matin", "hier soir", "aujourd'hui", "tout à l'heure", "", +] +P_ACTION = [ + "j'ai aperçu", "j'ai caressé", "j'ai nadenade", "j'ai passé du temps avec", + "je me suis arrêté vers", "je me suis promené avec", "j'ai salué", + "j'ai approché", +] +P_SUBJ = [ + "le chat", "des chats", "le chat calico", "le chat noir", "le chaton", + "le chat blanc", "le chat tigré", "le chat gris", "le chat avec le cœur", +] +P_PLACE = [ + "en ville", "au port de pêche", "sur l'île", "sous l'arbre", + "au monument de pierre", "sur la plage", "sur le chemin", "dans l'herbe", + "devant l'école", +] +P_COORD = [ + "et", "et donc", "et puis", "après quoi", +] +P_ACTION2 = [ + "il a miaulé", "il s'est endormi", "il m'a remercié", "il est resté", + "il m'a suivi", "il m'a reclamé un nadenade", +] + + +def get_title(): + return " ".join(( + random.choice(P_TIME), + random.choice(P_ACTION), + random.choice(P_SUBJ), + random.choice(P_PLACE), + random.choice(P_COORD), + random.choice(P_ACTION2), + )).strip().capitalize() + + +class DoupslandPlugin(Plugin): + + REQUIRED_CONFIGS = ["commands"] + + def __init__(self, bot): + super().__init__(bot) + + def on_pubmsg(self, event): + if not self.should_handle_command(event.arguments[0]): + return False + + reply = get_title() + self.bot.say(event.target, reply) + return True