Fixed QUADRUPLE MESSAGES WOW
|
@ -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/"
|
||||
|
|
|
@ -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/"
|
||||
|
|
|
@ -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/"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
@ -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
|
||||
|
|
|
@ -357,7 +357,7 @@ 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"
|
||||
|
@ -450,8 +450,8 @@ async def discussion_handler():
|
|||
await send_to_discord(message)
|
||||
if discussion_feed:
|
||||
DBHandler.add(db_wiki["wiki"], post["id"], True)
|
||||
await asyncio.sleep(delay=2.0) # hardcoded really doesn't need much more
|
||||
DBHandler.update_db()
|
||||
await asyncio.sleep(delay=2.0) # hardcoded really doesn't need much more
|
||||
except asyncio.CancelledError:
|
||||
pass
|
||||
except:
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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,6 +57,9 @@ class MessageQueue:
|
|||
if status[0] < 2:
|
||||
logger.debug("Sending message succeeded")
|
||||
try:
|
||||
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
|
||||
|
@ -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)
|
||||
# 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())
|
||||
|
|