from edmond.plugin import Plugin class CaptureListPlugin(Plugin): REQUIRED_CONFIGS = ["commands", "reply", "empty_reply"] def __init__(self, bot): super().__init__(bot) def on_welcome(self, _): if not self.bot.get_plugin("capture"): self.bot.log_w("Capture plugin is not available.") self.is_ready = False def on_pubmsg(self, event): if not self.should_handle_command(event.arguments[0]): return False collec_target = self.command.content or event.source.nick collections = self.get_storage_value( "collections", default={}, ns="capture" ) collection = collections.get(collec_target, []) if collection: reply = self.config["reply"].format( target=collec_target, num=len(collection), things="".join(collection), ) else: reply = self.config["empty_reply"].format(target=collec_target) self.bot.say(event.target, reply) return True