From 8530ea6ee58e649dc792b15ac7fe9f780f213503 Mon Sep 17 00:00:00 2001 From: adbenitez Date: Tue, 5 Mar 2024 22:37:28 -0500 Subject: [PATCH] update to deltabot-cli v4 --- feedsbot/hooks.py | 5 ++--- feedsbot/util.py | 8 -------- pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/feedsbot/hooks.py b/feedsbot/hooks.py index 9a56222..5a8a90c 100644 --- a/feedsbot/hooks.py +++ b/feedsbot/hooks.py @@ -22,14 +22,13 @@ check_feeds, format_entries, get_latest_date, - get_log_level, get_old_entries, normalize_url, parse_feed, set_group_image, ) -cli = BotCli("feedsbot", log_level=get_log_level("feedsbot")) +cli = BotCli("feedsbot") cli.add_generic_option( "--interval", type=int, @@ -76,7 +75,7 @@ def on_start(bot: Bot, args: Namespace) -> None: @cli.on(events.RawEvent) def log_event(bot: Bot, accid: int, event: AttrDict) -> None: if event.kind == EventType.INFO: - bot.logger.info(event.msg) + bot.logger.debug(event.msg) elif event.kind == EventType.WARNING: bot.logger.warning(event.msg) elif event.kind == EventType.ERROR: diff --git a/feedsbot/util.py b/feedsbot/util.py index 14693d5..ac885e0 100644 --- a/feedsbot/util.py +++ b/feedsbot/util.py @@ -2,9 +2,7 @@ import datetime import functools -import logging import mimetypes -import os import re import time from multiprocessing.pool import ThreadPool @@ -273,9 +271,3 @@ def set_group_image(bot: Bot, url: str, accid: int, chatid: int) -> None: bot.rpc.set_chat_profile_image(accid, chatid, temp_file.name) except JsonRpcError as ex: bot.logger.exception(ex) - - -def get_log_level(name: str) -> int: - """Get log level from environment variables. Defaults to INFO if not set.""" - level = os.getenv(f"{name.upper()}_LOG", "info").upper() - return int(getattr(logging, level)) diff --git a/pyproject.toml b/pyproject.toml index 1e441b0..e15466a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ classifiers = [ "License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)", ] dependencies = [ - "deltabot-cli>=3.2.4,<4.0", + "deltabot-cli>=4.0.0,<5.0", "SQLAlchemy>=2.0.25,<3.0", "feedparser>=6.0.11,<7.0", "requests>=2.28.1,<3.0",