diff --git a/src/bot.py b/src/bot.py index 06a7304..03a22f9 100644 --- a/src/bot.py +++ b/src/bot.py @@ -14,10 +14,12 @@ from src.misc import get_paths from src.msgqueue import messagequeue from src.queue_handler import DBHandler from src.wiki import Wiki, process_cats, process_mwmsgs, essential_info +from src.discord import DiscordMessage logging.config.dictConfig(settings["logging"]) logger = logging.getLogger("rcgcdb.bot") logger.debug("Current settings: {settings}".format(settings=settings)) +logger.info("RcGcDb v.{} is starting up.".format("1.0")) # Log Fail states with structure wiki_url: number of fail states all_wikis: dict = {} @@ -65,7 +67,7 @@ async def wiki_scanner(): logger.debug("Wiki {}".format(db_wiki["wiki"])) extended = False if db_wiki["wiki"] not in all_wikis: - logger.debug("New wiki: {}".format(db_wiki["wiki"])) + logger.info("Registering new wiki locally: {}".format(db_wiki["wiki"])) all_wikis[db_wiki["wiki"]] = Wiki() local_wiki = all_wikis[db_wiki["wiki"]] # set a reference to a wiki object from memory if local_wiki.mw_messages is None: @@ -141,8 +143,7 @@ def global_exception_handler(loop, context): """Global exception handler for asyncio, lets us know when something crashes""" msg = context.get("exception", context["message"]) logger.error("Global exception handler: {}".format(msg)) - requests.post("https://discord.com/api/webhooks/" + settings["monitoring_webhook"], data={"content": "test"}) - + requests.post("https://discord.com/api/webhooks/"+settings["monitoring_webhook"], data=repr(DiscordMessage("compact", "monitoring", [settings["monitoring_webhook"]], wiki=None, content="[RcGcDb] Global exception handler: {}".format(msg)))) async def main_loop(): loop = asyncio.get_event_loop() @@ -152,7 +153,7 @@ async def main_loop(): loop.add_signal_handler( s, lambda s=s: shutdown(loop, signal=s)) except AttributeError: - logger.info("Running on Windows huh? This complicates things") + logger.info("Running on Windows, some things may not work as they should.") signals = (signal.SIGBREAK, signal.SIGTERM, signal.SIGINT) loop.set_exception_handler(global_exception_handler) try: diff --git a/src/discord.py b/src/discord.py index 0592c87..94bcb0a 100644 --- a/src/discord.py +++ b/src/discord.py @@ -149,4 +149,6 @@ async def handle_discord_http(code, formatted_embed, result, dmsg): logger.error( "Discord have trouble processing the event, and because the HTTP code returned is {} it means we blame them.".format( code)) - return 3 \ No newline at end of file + return 3 + else: + return 4 diff --git a/src/formatters/rc.py b/src/formatters/rc.py index 6bd808f..06c882a 100644 --- a/src/formatters/rc.py +++ b/src/formatters/rc.py @@ -14,6 +14,10 @@ from bs4 import BeautifulSoup logger = logging.getLogger("rcgcdw.rc_formatters") +if 1 == 2: # additional translation strings in unreachable code + print(_("director"), _("bot"), _("editor"), _("directors"), _("sysop"), _("bureaucrat"), _("reviewer"), + _("autoreview"), _("autopatrol"), _("wiki_guardian"), ngettext("second", "seconds", 1), ngettext("minute", "minutes", 1), ngettext("hour", "hours", 1), ngettext("day", "days", 1), ngettext("week", "weeks", 1), ngettext("month", "months",1), ngettext("year", "years", 1), ngettext("millennium", "millennia", 1), ngettext("decade", "decades", 1), ngettext("century", "centuries", 1)) + async def compact_formatter(action, change, parsed_comment, categories, recent_changes, target, _, ngettext, paths, additional_data=None): """Recent Changes compact formatter, part of RcGcDw""" diff --git a/src/wiki.py b/src/wiki.py index 37e2b13..4d3c738 100644 --- a/src/wiki.py +++ b/src/wiki.py @@ -88,6 +88,7 @@ class Wiki: @staticmethod async def remove(wiki_url, reason): + logger.info("Removing a wiki {}".format(wiki_url)) await src.discord.wiki_removal(wiki_url, reason) await src.discord.wiki_removal_monitor(wiki_url, reason) db_cursor.execute('DELETE FROM rcgcdw WHERE wiki = ?', (wiki_url,))