Skip to content

Commit

Permalink
add --no-time option
Browse files Browse the repository at this point in the history
  • Loading branch information
adbenitez committed Mar 7, 2024
1 parent 75e4102 commit 187ae7e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion feedsbot/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
is_not_known_command,
)
from feedparser import FeedParserDict
from rich.logging import RichHandler
from sqlalchemy import delete, func, select

from .orm import Fchat, Feed, init, session_scope
Expand Down Expand Up @@ -47,10 +48,18 @@
default=-1,
help="the maximum number of feeds the bot will subscribe to before rejecting new unknown feeds, by default: -1 (infinite)",
)
cli.add_generic_option(
"--no-time",
help="do not display date timestamp in log messages",
action="store_false",
)


@cli.on_init
def on_init(bot: Bot, _args: Namespace) -> None:
def on_init(bot: Bot, args: Namespace) -> None:
bot.logger.handlers = [
RichHandler(show_path=False, omit_repeated_times=False, show_time=args.no_time)
]
for accid in bot.rpc.get_all_account_ids():
if not bot.rpc.get_config(accid, "displayname"):
bot.rpc.set_config(accid, "displayname", "FeedsBot")
Expand Down
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>=4.0.0,<5.0",
"deltabot-cli>=5.0.0,<6.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 187ae7e

Please sign in to comment.