mirror of
https://gitlab.com/chicken-riders/RcGcDw.git
synced 2025-02-23 00:24:09 +00:00
Code style update
This commit is contained in:
parent
b9ad72b02f
commit
9e96098f72
15
rcgcdw.py
15
rcgcdw.py
|
@ -43,7 +43,7 @@ except FileNotFoundError:
|
|||
|
||||
logged_in = False
|
||||
logging.basicConfig(level=settings["verbose_level"])
|
||||
if settings["limitrefetch"] != -1 and os.path.exists("lastchange.txt") == False:
|
||||
if settings["limitrefetch"] != -1 and os.path.exists("lastchange.txt") is False:
|
||||
with open("lastchange.txt", 'w') as sfile:
|
||||
sfile.write("99999999999")
|
||||
logging.debug("Current settings: {settings}".format(settings=settings))
|
||||
|
@ -93,8 +93,7 @@ LinkParser = LinkParser()
|
|||
|
||||
|
||||
def send(message, name, avatar):
|
||||
dictionary_creator = {}
|
||||
dictionary_creator["content"] = message
|
||||
dictionary_creator = {"content": message}
|
||||
if name:
|
||||
dictionary_creator["username"] = name
|
||||
if avatar:
|
||||
|
@ -195,7 +194,7 @@ def webhook_formatter(action, STATIC, **params):
|
|||
if editsize < -6032:
|
||||
colornumber = 16711680
|
||||
else:
|
||||
colornumber = 9175040 + (math.floor((editsize * -1) / (52))) * 65536
|
||||
colornumber = 9175040 + (math.floor((editsize * -1) / 52)) * 65536
|
||||
elif editsize == 0:
|
||||
colornumber = 8750469
|
||||
link = "https://{wiki}.gamepedia.com/index.php?title={article}&curid={pageid}&diff={diff}&oldid={oldrev}".format(
|
||||
|
@ -210,7 +209,6 @@ def webhook_formatter(action, STATIC, **params):
|
|||
urls = safe_read(recent_changes.safe_request(
|
||||
"https://{wiki}.gamepedia.com/api.php?action=query&format=json&prop=imageinfo&list=&meta=&titles={filename}&iiprop=timestamp%7Curl&iilimit=2".format(
|
||||
wiki=settings["wiki"], filename=params["title"])), "query", "pages")
|
||||
undolink = ""
|
||||
link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"],
|
||||
article=params["title"].replace(" ", "_"))
|
||||
additional_info_retrieved = False
|
||||
|
@ -277,7 +275,7 @@ def webhook_formatter(action, STATIC, **params):
|
|||
article=params["target"].replace(" ", "_"))
|
||||
params["desc"] = "{supress}. {desc}".format(desc=params["desc"],
|
||||
supress=_("No redirect has been made") if params[
|
||||
"supress"] == True else _(
|
||||
"supress"] is True else _(
|
||||
"A redirect has been made"))
|
||||
embed["title"] = _("Moved {redirect}{article} to {target}").format(redirect="⤷ " if STATIC["redirect"] else "", article=params["title"], target=params["target"])
|
||||
elif action == "move/move_redir":
|
||||
|
@ -886,7 +884,8 @@ class Recent_Changes_Class(object):
|
|||
else:
|
||||
file_id = 999999999 # such value won't cause trouble, and it will make sure no refetch happen
|
||||
|
||||
def handle_mw_errors(self, request):
|
||||
@staticmethod
|
||||
def handle_mw_errors(request):
|
||||
if "errors" in request:
|
||||
logging.error(request["errors"])
|
||||
raise MWError
|
||||
|
@ -1139,7 +1138,7 @@ time.sleep(1.0)
|
|||
recent_changes.fetch(amount=settings["limitrefetch"] if settings["limitrefetch"] != -1 else settings["limit"])
|
||||
|
||||
schedule.every(settings["cooldown"]).seconds.do(recent_changes.fetch)
|
||||
if 1 == 2:
|
||||
if 1 == 2: # additional translation strings in unreachable code
|
||||
print(_("director"), _("bot"), _("editor"), _("directors"), _("sysop"), _("bureaucrat"), _("reviewer"),
|
||||
_("autoreview"), _("autopatrol"), _("wiki_guardian"))
|
||||
|
||||
|
|
Loading…
Reference in a new issue