Merge branch 'cherry-pick-27f00cdf' into 'master'

1.15.0.1

See merge request piotrex43/RcGcDw!103
This commit is contained in:
Frisk 2022-07-14 23:50:03 +00:00
commit 0c863f209c
4 changed files with 6 additions and 7 deletions

View file

@ -2,7 +2,7 @@ from setuptools import setup
setup( setup(
name='RcGcDw', name='RcGcDw',
version='1.14.0.1', version='1.15.0.1',
url='https://gitlab.com/piotrex43/RcGcDw/', url='https://gitlab.com/piotrex43/RcGcDw/',
license='GNU GPLv3', license='GNU GPLv3',
author='Frisk', author='Frisk',

View file

@ -28,7 +28,7 @@ def load_settings():
if settings["limitrefetch"] < settings["limit"] and settings["limitrefetch"] != -1: if settings["limitrefetch"] < settings["limit"] and settings["limitrefetch"] != -1:
settings["limitrefetch"] = settings["limit"] settings["limitrefetch"] = settings["limit"]
if "user-agent" in settings["header"]: if "user-agent" in settings["header"]:
settings["header"]["user-agent"] = settings["header"]["user-agent"].format(version="1.14.1") # set the version in the useragent settings["header"]["user-agent"] = settings["header"]["user-agent"].format(version="1.15.0.1") # set the version in the useragent
except FileNotFoundError: except FileNotFoundError:
logging.critical("No config file could be found. Please make sure settings.json is in the directory.") logging.critical("No config file could be found. Please make sure settings.json is in the directory.")
sys.exit(1) sys.exit(1)

View file

@ -29,6 +29,7 @@ from src.exceptions import ArticleCommentError, NoFormatter
from src.api.util import default_message from src.api.util import default_message
from src.api.context import Context from src.api.context import Context
from src.api.hooks import formatter_hooks, pre_hooks, post_hooks from src.api.hooks import formatter_hooks, pre_hooks, post_hooks
from src.i18n import formatters_i18n
# Create a custom logger # Create a custom logger
@ -56,6 +57,7 @@ def inject_client(client_obj):
"""Function to avoid circular import issues""" """Function to avoid circular import issues"""
global client global client
client = client_obj client = client_obj
client.schedule(fetch_discussions, every=settings["fandom_discussions"]["cooldown"])
def fetch_discussions(): def fetch_discussions():
@ -107,7 +109,7 @@ def parse_discussion_post(post, comment_pages):
"""Initial post recognition & handling""" """Initial post recognition & handling"""
global client global client
post_type = post["_embedded"]["thread"][0]["containerType"] post_type = post["_embedded"]["thread"][0]["containerType"]
context = Context(display_mode, "discussion", webhook_url, client) context = Context(display_mode, "discussion", webhook_url, client, formatters_i18n, settings)
# Filter posts by forum # Filter posts by forum
if post_type == "FORUM" and settings["fandom_discussions"].get("show_forums", []): if post_type == "FORUM" and settings["fandom_discussions"].get("show_forums", []):
if not post["forumName"] in settings["fandom_discussions"]["show_forums"]: if not post["forumName"] in settings["fandom_discussions"]["show_forums"]:
@ -157,6 +159,3 @@ def safe_request(url) -> Optional[requests.Response]:
return None return None
return request return request
client.schedule(fetch_discussions, every=settings["fandom_discussions"]["cooldown"])

View file

@ -279,7 +279,7 @@ def abuselog_processing(entry):
action = "abuselog" action = "abuselog"
if action in settings["ignored"]: if action in settings["ignored"]:
return return
context = Context(settings["appearance"]["mode"], "abuselog", settings["webhookURL"], client) context = Context(settings["appearance"]["mode"], "abuselog", settings["webhookURL"], client, formatters_i18n, settings)
context.event = action context.event = action
run_hooks(pre_hooks, context, entry) run_hooks(pre_hooks, context, entry)
try: try: