mirror of
https://gitlab.com/chicken-riders/RcGcDb.git
synced 2025-02-23 00:54:09 +00:00
Very small fixes/improvements
This commit is contained in:
parent
d78bdb9718
commit
5ca8ccc83b
|
@ -374,12 +374,12 @@ async def discussion_handler():
|
||||||
for post in discussion_feed:
|
for post in discussion_feed:
|
||||||
if post["_embedded"]["thread"][0]["containerType"] == "ARTICLE_COMMENT" and post["id"] > db_wiki["postid"]:
|
if post["_embedded"]["thread"][0]["containerType"] == "ARTICLE_COMMENT" and post["id"] > db_wiki["postid"]:
|
||||||
comment_events.append(post["forumId"])
|
comment_events.append(post["forumId"])
|
||||||
comment_pages = {}
|
comment_pages: dict = {}
|
||||||
if len(comment_events):
|
if comment_events:
|
||||||
comment_pages = await local_wiki.safe_request(
|
comment_pages = await local_wiki.safe_request(
|
||||||
"{wiki}wikia.php?controller=FeedsAndPosts&method=getArticleNamesAndUsernames&stablePageIds={pages}&format=json".format(
|
"{wiki}wikia.php?controller=FeedsAndPosts&method=getArticleNamesAndUsernames&stablePageIds={pages}&format=json".format(
|
||||||
wiki=db_wiki["wiki"], pages=','.join(comment_events)
|
wiki=db_wiki["wiki"], pages=",".join(comment_events)
|
||||||
), rate_limiter, "articleNames") # rate_limiter is undefined, needs fixing
|
), RateLimiter(), "articleNames")
|
||||||
for post in discussion_feed: # Yeah, second loop since the comments require an extra request
|
for post in discussion_feed: # Yeah, second loop since the comments require an extra request
|
||||||
if post["id"] > db_wiki["postid"]:
|
if post["id"] > db_wiki["postid"]:
|
||||||
for target in targets.items():
|
for target in targets.items():
|
||||||
|
|
|
@ -8,6 +8,7 @@ from src.formatters.discussions import feeds_embed_formatter, feeds_compact_form
|
||||||
from src.misc import parse_link
|
from src.misc import parse_link
|
||||||
from src.i18n import langs
|
from src.i18n import langs
|
||||||
from src.wiki_ratelimiter import RateLimiter
|
from src.wiki_ratelimiter import RateLimiter
|
||||||
|
import sqlite3
|
||||||
import src.discord
|
import src.discord
|
||||||
import asyncio
|
import asyncio
|
||||||
from src.config import settings
|
from src.config import settings
|
||||||
|
@ -225,7 +226,7 @@ async def essential_info(change: dict, changed_categories, local_wiki: Wiki, tar
|
||||||
await appearance_mode(identification_string, change, parsed_comment, changed_categories, local_wiki, target, paths, rate_limiter, additional_data=additional_data)
|
await appearance_mode(identification_string, change, parsed_comment, changed_categories, local_wiki, target, paths, rate_limiter, additional_data=additional_data)
|
||||||
|
|
||||||
|
|
||||||
async def essential_feeds(change: dict, comment_pages, db_wiki: tuple, target: tuple):
|
async def essential_feeds(change: dict, comment_pages: dict, db_wiki: sqlite3.Row, target: tuple):
|
||||||
"""Prepares essential information for both embed and compact message format."""
|
"""Prepares essential information for both embed and compact message format."""
|
||||||
appearance_mode = feeds_embed_formatter if target[0][1] > 0 else feeds_compact_formatter
|
appearance_mode = feeds_embed_formatter if target[0][1] > 0 else feeds_compact_formatter
|
||||||
identification_string = change["_embedded"]["thread"][0]["containerType"]
|
identification_string = change["_embedded"]["thread"][0]["containerType"]
|
||||||
|
|
Loading…
Reference in a new issue