Source code for my personal quote bot project.

script: minor change to quickly add a finite list of files to queue.

crashkeys.dev 43d4c079 7855cf77

Waiting for spindle ...
+3 -2
+3 -2
redis_random_push.py
··· 14 14 import redis 15 15 import typer 16 16 17 - def main(source_key, destination_key, rename_key: bool = False, password: str = "", host: str = "localhost", port: int = 16379, quotes_pattern: str = "quotes/**/*.txt", log_level: str = "INFO") -> None: 17 + def main(source_key, destination_key, rename_key: bool = False, password: str = "", host: str = "localhost", port: int = 16379, quotes_pattern: str = "quotes/**/*.txt", quotes_list_file: Path | None = None, log_level: str = "INFO") -> None: 18 18 logging.getLogger().setLevel(os.getenv("LOGGING") or log_level) 19 19 20 - new_quotes = tuple(iglob(quotes_pattern, recursive=True)) 20 + new_quotes = tuple(iglob(quotes_pattern, recursive=True)) if not quotes_list_file else tuple(line for line in quotes_list_file.read_text().split("\n") if line) 21 + logging.info("Quotes to add: `%s`", new_quotes) 21 22 r = redis.Redis(host=host, port=port, decode_responses=True, password=password) 22 23 23 24 logging.info("Fetching existing list at key `%s`.", source_key)