Skip to content

Commit

Permalink
update to deltabot-cli v4
Browse files Browse the repository at this point in the history
  • Loading branch information
adbenitez committed Mar 6, 2024
1 parent b43cbea commit 8530ea6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
5 changes: 2 additions & 3 deletions feedsbot/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand Down
8 changes: 0 additions & 8 deletions feedsbot/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

import datetime
import functools
import logging
import mimetypes
import os
import re
import time
from multiprocessing.pool import ThreadPool
Expand Down Expand Up @@ -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))
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 8530ea6

Please sign in to comment.