Fixed QUADRUPLE MESSAGES WOW

This commit is contained in:
Frisk 2020-11-30 14:21:54 +01:00
parent 22f58df474
commit 3dbb377630
No known key found for this signature in database
GPG key ID: 213F7C15068AF8AC
21 changed files with 25 additions and 21 deletions

Binary file not shown.

View file

@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-11-29 00:18+0100\n"
"POT-Creation-Date: 2020-11-29 00:25+0100\n"
"PO-Revision-Date: 2020-11-28 22:58+0000\n"
"Last-Translator: MarkusRost <sukramxro@gmail.com>\n"
"Language-Team: German <https://translate.wikibot.de/projects/rcgcdw/"

Binary file not shown.

View file

@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: RcGcDw\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-11-29 00:18+0100\n"
"POT-Creation-Date: 2020-11-29 00:25+0100\n"
"PO-Revision-Date: 2020-11-20 09:22+0000\n"
"Last-Translator: Frisk The Evil Goat Overlord <piotrex43@protonmail.ch>\n"
"Language-Team: Polish <https://weblate.frisk.space/projects/rcgcdw/"

Binary file not shown.

View file

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-11-29 00:18+0100\n"
"POT-Creation-Date: 2020-11-29 00:25+0100\n"
"PO-Revision-Date: 2020-11-27 13:07+0000\n"
"Last-Translator: dr03ramos <dr03ramos@gmail.com>\n"
"Language-Team: Portuguese (Brazil) <https://translate.wikibot.de/projects/"

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: RcGcDb\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-11-29 00:18+0100\n"
"POT-Creation-Date: 2020-11-29 00:25+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: RcGcDb\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-11-29 00:18+0100\n"
"POT-Creation-Date: 2020-11-29 00:25+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: RcGcDb\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-11-29 00:18+0100\n"
"POT-Creation-Date: 2020-11-29 00:25+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: RcGcDb\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-11-29 00:18+0100\n"
"POT-Creation-Date: 2020-11-29 00:25+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: RcGcDb\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-11-29 00:18+0100\n"
"POT-Creation-Date: 2020-11-29 00:25+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

@ -6,7 +6,7 @@ xgettext -L Python --package-name=RcGcDb -o locale/templates/discord.pot src/dis
xgettext -L Python --package-name=RcGcDb -o locale/templates/misc.pot src/misc.py
declare -a StringArray=("discussion_formatters" "rc_formatters" "discord" "wiki" "misc")
for language in de pl pt-br
for language in de pl pt-br hi ru uk
do
for file in ${StringArray[@]}; do
msgmerge -U locale/$language/LC_MESSAGES/$file.po locale/templates/$file.pot

View file

@ -357,12 +357,12 @@ async def discussion_handler():
try:
while True:
fetch_all = db_cursor.execute(
"SELECT wiki, rcid, postid FROM rcgcdw WHERE postid != '-1' OR postid IS NULL")
"SELECT wiki, rcid, postid FROM rcgcdw WHERE postid != '-1' OR postid IS NULL GROUP BY wiki")
for db_wiki in fetch_all.fetchall():
header = settings["header"]
header["Accept"] = "application/hal+json"
async with aiohttp.ClientSession(headers=header,
timeout=aiohttp.ClientTimeout(6.0)) as session:
timeout=aiohttp.ClientTimeout(6.0)) as session:
try:
local_wiki = all_wikis[db_wiki["wiki"]] # set a reference to a wiki object from memory
except KeyError:
@ -379,7 +379,7 @@ async def discussion_handler():
if error == "site doesn't exists": # Discussions disabled
if db_wiki["rcid"] != -1: # RC feed is disabled
db_cursor.execute("UPDATE rcgcdw SET postid = ? WHERE wiki = ?",
("-1", db_wiki["wiki"],))
("-1", db_wiki["wiki"],))
else:
await local_wiki.remove(db_wiki["wiki"], 1000)
DBHandler.update_db()
@ -450,8 +450,8 @@ async def discussion_handler():
await send_to_discord(message)
if discussion_feed:
DBHandler.add(db_wiki["wiki"], post["id"], True)
DBHandler.update_db()
await asyncio.sleep(delay=2.0) # hardcoded really doesn't need much more
DBHandler.update_db()
except asyncio.CancelledError:
pass
except:

View file

@ -8,7 +8,6 @@ import datetime
from src.config import settings
from src.misc import link_formatter, create_article_path, parse_link, profile_field_name, ContentParser
from src.discord import DiscordMessage
from src.msgqueue import send_to_discord
from src.i18n import langs
from bs4 import BeautifulSoup
@ -211,14 +210,14 @@ async def compact_formatter(action, change, parsed_comment, categories, recent_c
author_url=author_url,
target=target_user,
target_url=link,
field=profile_field_name(change["logparams"]['4:section'], False),
field=profile_field_name(change["logparams"]['4:section'], False, message_target[0][0]),
desc=BeautifulSoup(change["parsedcomment"], "lxml").get_text())
else:
content = "📌 " + _("[{author}]({author_url}) edited the {field} on [their own]({target_url}) profile. *({desc})*").format(
author=author,
author_url=author_url,
target_url=link,
field=profile_field_name(change["logparams"]['4:section'], False),
field=profile_field_name(change["logparams"]['4:section'], False, message_target[0][0]),
desc=BeautifulSoup(change["parsedcomment"], "lxml").get_text())
elif action in ("rights/rights", "rights/autopromote"):
link = link_formatter(create_article_path("User:{user}".format(user=change["title"].split(":")[1]), WIKI_ARTICLE_PATH))

View file

@ -25,6 +25,7 @@ class MessageQueue:
def add_message(self, message):
self._queue.append(message)
logger.debug("Adding new message")
#
# def replace_message(self, to_replace: DiscordMessage, with_replace: StackedDiscordMessage):
# try:
@ -56,7 +57,10 @@ class MessageQueue:
if status[0] < 2:
logger.debug("Sending message succeeded")
try:
self._queue.remove(msg)
if len(msg.webhook_url) > 1:
msg.webhook_url.remove(webhook_url)
else:
self._queue.remove(msg)
except ValueError:
# For the love of god I cannot figure why can it return ValueError: list.remove(x): x not in list, however considering it's not in the list, somehow, anymore we can just not care about it I guess
pass
@ -92,7 +96,8 @@ messagequeue = MessageQueue()
async def send_to_discord(msg):
webhooks = msg.webhook_url.copy()
for webhook in webhooks:
msg.webhook_url = [webhook]
messagequeue.add_message(msg)
messagequeue.add_message(msg)
# webhooks = msg.webhook_url.copy()
# for webhook in webhooks:
# msg.webhook_url = [webhook] # Doing it just so it doesn't store reference but value
# messagequeue.add_message(msg.copy())