Fixed QUADRUPLE MESSAGES WOW
|
@ -2,7 +2,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: \n"
|
"Project-Id-Version: \n"
|
||||||
"Report-Msgid-Bugs-To: \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"
|
"PO-Revision-Date: 2020-11-28 22:58+0000\n"
|
||||||
"Last-Translator: MarkusRost <sukramxro@gmail.com>\n"
|
"Last-Translator: MarkusRost <sukramxro@gmail.com>\n"
|
||||||
"Language-Team: German <https://translate.wikibot.de/projects/rcgcdw/"
|
"Language-Team: German <https://translate.wikibot.de/projects/rcgcdw/"
|
||||||
|
|
|
@ -6,7 +6,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: RcGcDw\n"
|
"Project-Id-Version: RcGcDw\n"
|
||||||
"Report-Msgid-Bugs-To: \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"
|
"PO-Revision-Date: 2020-11-20 09:22+0000\n"
|
||||||
"Last-Translator: Frisk The Evil Goat Overlord <piotrex43@protonmail.ch>\n"
|
"Last-Translator: Frisk The Evil Goat Overlord <piotrex43@protonmail.ch>\n"
|
||||||
"Language-Team: Polish <https://weblate.frisk.space/projects/rcgcdw/"
|
"Language-Team: Polish <https://weblate.frisk.space/projects/rcgcdw/"
|
||||||
|
|
|
@ -7,7 +7,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: \n"
|
"Project-Id-Version: \n"
|
||||||
"Report-Msgid-Bugs-To: \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"
|
"PO-Revision-Date: 2020-11-27 13:07+0000\n"
|
||||||
"Last-Translator: dr03ramos <dr03ramos@gmail.com>\n"
|
"Last-Translator: dr03ramos <dr03ramos@gmail.com>\n"
|
||||||
"Language-Team: Portuguese (Brazil) <https://translate.wikibot.de/projects/"
|
"Language-Team: Portuguese (Brazil) <https://translate.wikibot.de/projects/"
|
||||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: RcGcDb\n"
|
"Project-Id-Version: RcGcDb\n"
|
||||||
"Report-Msgid-Bugs-To: \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"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: RcGcDb\n"
|
"Project-Id-Version: RcGcDb\n"
|
||||||
"Report-Msgid-Bugs-To: \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"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: RcGcDb\n"
|
"Project-Id-Version: RcGcDb\n"
|
||||||
"Report-Msgid-Bugs-To: \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"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: RcGcDb\n"
|
"Project-Id-Version: RcGcDb\n"
|
||||||
"Report-Msgid-Bugs-To: \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"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: RcGcDb\n"
|
"Project-Id-Version: RcGcDb\n"
|
||||||
"Report-Msgid-Bugs-To: \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"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\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
|
xgettext -L Python --package-name=RcGcDb -o locale/templates/misc.pot src/misc.py
|
||||||
|
|
||||||
declare -a StringArray=("discussion_formatters" "rc_formatters" "discord" "wiki" "misc")
|
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
|
do
|
||||||
for file in ${StringArray[@]}; do
|
for file in ${StringArray[@]}; do
|
||||||
msgmerge -U locale/$language/LC_MESSAGES/$file.po locale/templates/$file.pot
|
msgmerge -U locale/$language/LC_MESSAGES/$file.po locale/templates/$file.pot
|
||||||
|
|
|
@ -357,12 +357,12 @@ async def discussion_handler():
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
fetch_all = db_cursor.execute(
|
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():
|
for db_wiki in fetch_all.fetchall():
|
||||||
header = settings["header"]
|
header = settings["header"]
|
||||||
header["Accept"] = "application/hal+json"
|
header["Accept"] = "application/hal+json"
|
||||||
async with aiohttp.ClientSession(headers=header,
|
async with aiohttp.ClientSession(headers=header,
|
||||||
timeout=aiohttp.ClientTimeout(6.0)) as session:
|
timeout=aiohttp.ClientTimeout(6.0)) as session:
|
||||||
try:
|
try:
|
||||||
local_wiki = all_wikis[db_wiki["wiki"]] # set a reference to a wiki object from memory
|
local_wiki = all_wikis[db_wiki["wiki"]] # set a reference to a wiki object from memory
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
@ -379,7 +379,7 @@ async def discussion_handler():
|
||||||
if error == "site doesn't exists": # Discussions disabled
|
if error == "site doesn't exists": # Discussions disabled
|
||||||
if db_wiki["rcid"] != -1: # RC feed is disabled
|
if db_wiki["rcid"] != -1: # RC feed is disabled
|
||||||
db_cursor.execute("UPDATE rcgcdw SET postid = ? WHERE wiki = ?",
|
db_cursor.execute("UPDATE rcgcdw SET postid = ? WHERE wiki = ?",
|
||||||
("-1", db_wiki["wiki"],))
|
("-1", db_wiki["wiki"],))
|
||||||
else:
|
else:
|
||||||
await local_wiki.remove(db_wiki["wiki"], 1000)
|
await local_wiki.remove(db_wiki["wiki"], 1000)
|
||||||
DBHandler.update_db()
|
DBHandler.update_db()
|
||||||
|
@ -450,8 +450,8 @@ async def discussion_handler():
|
||||||
await send_to_discord(message)
|
await send_to_discord(message)
|
||||||
if discussion_feed:
|
if discussion_feed:
|
||||||
DBHandler.add(db_wiki["wiki"], post["id"], True)
|
DBHandler.add(db_wiki["wiki"], post["id"], True)
|
||||||
|
DBHandler.update_db()
|
||||||
await asyncio.sleep(delay=2.0) # hardcoded really doesn't need much more
|
await asyncio.sleep(delay=2.0) # hardcoded really doesn't need much more
|
||||||
DBHandler.update_db()
|
|
||||||
except asyncio.CancelledError:
|
except asyncio.CancelledError:
|
||||||
pass
|
pass
|
||||||
except:
|
except:
|
||||||
|
|
|
@ -8,7 +8,6 @@ import datetime
|
||||||
from src.config import settings
|
from src.config import settings
|
||||||
from src.misc import link_formatter, create_article_path, parse_link, profile_field_name, ContentParser
|
from src.misc import link_formatter, create_article_path, parse_link, profile_field_name, ContentParser
|
||||||
from src.discord import DiscordMessage
|
from src.discord import DiscordMessage
|
||||||
from src.msgqueue import send_to_discord
|
|
||||||
from src.i18n import langs
|
from src.i18n import langs
|
||||||
|
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
@ -211,14 +210,14 @@ async def compact_formatter(action, change, parsed_comment, categories, recent_c
|
||||||
author_url=author_url,
|
author_url=author_url,
|
||||||
target=target_user,
|
target=target_user,
|
||||||
target_url=link,
|
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())
|
desc=BeautifulSoup(change["parsedcomment"], "lxml").get_text())
|
||||||
else:
|
else:
|
||||||
content = "📌 " + _("[{author}]({author_url}) edited the {field} on [their own]({target_url}) profile. *({desc})*").format(
|
content = "📌 " + _("[{author}]({author_url}) edited the {field} on [their own]({target_url}) profile. *({desc})*").format(
|
||||||
author=author,
|
author=author,
|
||||||
author_url=author_url,
|
author_url=author_url,
|
||||||
target_url=link,
|
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())
|
desc=BeautifulSoup(change["parsedcomment"], "lxml").get_text())
|
||||||
elif action in ("rights/rights", "rights/autopromote"):
|
elif action in ("rights/rights", "rights/autopromote"):
|
||||||
link = link_formatter(create_article_path("User:{user}".format(user=change["title"].split(":")[1]), WIKI_ARTICLE_PATH))
|
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):
|
def add_message(self, message):
|
||||||
self._queue.append(message)
|
self._queue.append(message)
|
||||||
|
logger.debug("Adding new message")
|
||||||
#
|
#
|
||||||
# def replace_message(self, to_replace: DiscordMessage, with_replace: StackedDiscordMessage):
|
# def replace_message(self, to_replace: DiscordMessage, with_replace: StackedDiscordMessage):
|
||||||
# try:
|
# try:
|
||||||
|
@ -56,7 +57,10 @@ class MessageQueue:
|
||||||
if status[0] < 2:
|
if status[0] < 2:
|
||||||
logger.debug("Sending message succeeded")
|
logger.debug("Sending message succeeded")
|
||||||
try:
|
try:
|
||||||
self._queue.remove(msg)
|
if len(msg.webhook_url) > 1:
|
||||||
|
msg.webhook_url.remove(webhook_url)
|
||||||
|
else:
|
||||||
|
self._queue.remove(msg)
|
||||||
except ValueError:
|
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
|
# 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
|
pass
|
||||||
|
@ -92,7 +96,8 @@ messagequeue = MessageQueue()
|
||||||
|
|
||||||
|
|
||||||
async def send_to_discord(msg):
|
async def send_to_discord(msg):
|
||||||
webhooks = msg.webhook_url.copy()
|
messagequeue.add_message(msg)
|
||||||
for webhook in webhooks:
|
# webhooks = msg.webhook_url.copy()
|
||||||
msg.webhook_url = [webhook]
|
# for webhook in webhooks:
|
||||||
messagequeue.add_message(msg)
|
# msg.webhook_url = [webhook] # Doing it just so it doesn't store reference but value
|
||||||
|
# messagequeue.add_message(msg.copy())
|
||||||
|
|