mirror of
https://gitlab.com/chicken-riders/RcGcDb.git
synced 2025-02-23 00:54:09 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
d47fd6df5c
|
@ -336,6 +336,11 @@
|
||||||
"color": 65280,
|
"color": 65280,
|
||||||
"emoji": "🗿"
|
"emoji": "🗿"
|
||||||
},
|
},
|
||||||
|
"newusers/reclaim": {
|
||||||
|
"icon": "",
|
||||||
|
"color": 65280,
|
||||||
|
"emoji": "🗿"
|
||||||
|
},
|
||||||
"managewiki/delete": {
|
"managewiki/delete": {
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"color": 8421504,
|
"color": 8421504,
|
||||||
|
|
|
@ -303,6 +303,8 @@ async def compact_formatter(action, change, parsed_comment, categories, recent_c
|
||||||
content = _("Account [{article}]({article_url}) was created by [{author}]({author_url}) and password was sent by email{comment}").format(article=change["title"], article_url=link, author=author, author_url=author_url, comment=parsed_comment)
|
content = _("Account [{article}]({article_url}) was created by [{author}]({author_url}) and password was sent by email{comment}").format(article=change["title"], article_url=link, author=author, author_url=author_url, comment=parsed_comment)
|
||||||
elif action == "newusers/newusers":
|
elif action == "newusers/newusers":
|
||||||
content = _("Account [{author}]({author_url}) was created").format(author=author, author_url=author_url)
|
content = _("Account [{author}]({author_url}) was created").format(author=author, author_url=author_url)
|
||||||
|
elif action == "newusers/reclaim":
|
||||||
|
content = _("Account [{author}]({author_url}) was reclaimed").format(author=author, author_url=author_url)
|
||||||
elif action == "interwiki/iw_add":
|
elif action == "interwiki/iw_add":
|
||||||
link = link_formatter(create_article_path("Special:Interwiki", WIKI_ARTICLE_PATH))
|
link = link_formatter(create_article_path("Special:Interwiki", WIKI_ARTICLE_PATH))
|
||||||
content = _("[{author}]({author_url}) added an entry to the [interwiki table]({table_url}) pointing to {website} with {prefix} prefix").format(author=author, author_url=author_url, desc=parsed_comment,
|
content = _("[{author}]({author_url}) added an entry to the [interwiki table]({table_url}) pointing to {website} with {prefix} prefix").format(author=author, author_url=author_url, desc=parsed_comment,
|
||||||
|
@ -928,6 +930,9 @@ async def embed_formatter(action, change, parsed_comment, categories, recent_cha
|
||||||
elif action == "newusers/newusers":
|
elif action == "newusers/newusers":
|
||||||
link = author_url
|
link = author_url
|
||||||
embed["title"] = _("Created account")
|
embed["title"] = _("Created account")
|
||||||
|
elif action == "newusers/reclaim":
|
||||||
|
link = author_url
|
||||||
|
embed["title"] = _("Reclaimed account")
|
||||||
elif action == "interwiki/iw_add":
|
elif action == "interwiki/iw_add":
|
||||||
link = create_article_path("Special:Interwiki", WIKI_ARTICLE_PATH)
|
link = create_article_path("Special:Interwiki", WIKI_ARTICLE_PATH)
|
||||||
embed["title"] = _("Added an entry to the interwiki table")
|
embed["title"] = _("Added an entry to the interwiki table")
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import re
|
||||||
import irc.client_aio
|
import irc.client_aio
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
@ -26,14 +26,15 @@ class AioIRCCat(irc.client_aio.AioSimpleIRCClient):
|
||||||
|
|
||||||
def on_welcome(self, connection, event): # Join IRC channels
|
def on_welcome(self, connection, event): # Join IRC channels
|
||||||
for channel in self.targets.values():
|
for channel in self.targets.values():
|
||||||
connection.join(channel)
|
if channel is not None:
|
||||||
|
connection.join(channel)
|
||||||
|
|
||||||
def on_pubmsg(self, connection, event):
|
def on_pubmsg(self, connection, event):
|
||||||
self.active = True
|
self.active = True
|
||||||
if event.target == self.targets["rc"]:
|
if event.target == self.targets["rc"]:
|
||||||
self.parse_fandom_message(' '.join(event.arguments))
|
self.parse_rc_message(' '.join(event.arguments))
|
||||||
elif event.target == self.targets["discussion"]:
|
elif event.target == self.targets["discussion"]:
|
||||||
self.parse_fandom_discussion(' '.join(event.arguments))
|
self.parse_discussion_message(' '.join(event.arguments))
|
||||||
|
|
||||||
def on_nicknameinuse(self, c, e):
|
def on_nicknameinuse(self, c, e):
|
||||||
c.nick(c.get_nickname() + "_")
|
c.nick(c.get_nickname() + "_")
|
||||||
|
@ -41,9 +42,11 @@ class AioIRCCat(irc.client_aio.AioSimpleIRCClient):
|
||||||
def on_disconnect(self, connection, event):
|
def on_disconnect(self, connection, event):
|
||||||
self.connect(*self.connection_details[0], **self.connection_details[1]) # attempt to reconnect
|
self.connect(*self.connection_details[0], **self.connection_details[1]) # attempt to reconnect
|
||||||
|
|
||||||
def parse_fandom_message(self, message: str):
|
def parse_rc_message(self, message: str):
|
||||||
message = message.split("\x035*\x03")
|
message = message.split("\x035*\x03")
|
||||||
# print(asyncio.all_tasks())
|
# print(asyncio.all_tasks())
|
||||||
|
if self.targets["rc"] == "#miraheze-feed":
|
||||||
|
message[0] = re.sub(r"^(\w+)wiki $", "\x0302https://\\1.miraheze.org/w/", message[0]) # Convert miraheze database name to wiki script path
|
||||||
half = message[0].find("\x0302http")
|
half = message[0].find("\x0302http")
|
||||||
if half == -1:
|
if half == -1:
|
||||||
return
|
return
|
||||||
|
@ -55,7 +58,7 @@ class AioIRCCat(irc.client_aio.AioSimpleIRCClient):
|
||||||
self.updated.add(full_url)
|
self.updated.add(full_url)
|
||||||
logger.debug("New website appended to the list! {}".format(full_url))
|
logger.debug("New website appended to the list! {}".format(full_url))
|
||||||
|
|
||||||
def parse_fandom_discussion(self, message: str):
|
def parse_discussion_message(self, message: str):
|
||||||
try:
|
try:
|
||||||
post = json.loads(message)
|
post = json.loads(message)
|
||||||
except json.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
|
|
Loading…
Reference in a new issue