Changed from using problematic UTC time to local machine time when it comes to day overviews for now

This commit is contained in:
Frisk 2018-06-22 17:14:13 +02:00
parent 941e7de3a7
commit cca18a0052
No known key found for this signature in database
GPG key ID: 0E9A7D3C0A01586C
3 changed files with 4 additions and 7 deletions

View file

@ -32,7 +32,7 @@ Explanation for settings:
`show_updown_messages` bool value, depending on this settings the messages whenever the wiki goes up and down will be sent to the channel `show_updown_messages` bool value, depending on this settings the messages whenever the wiki goes up and down will be sent to the channel
`appearience` section with different types of actions and logs, and corresponding to them colors/icons. In here you can set custom icon or color! `appearience` section with different types of actions and logs, and corresponding to them colors/icons. In here you can set custom icon or color!
`overview` bool value, sends a day overview to the channel if true `overview` bool value, sends a day overview to the channel if true
`overview_UTC_time` UTC time at which the day overview will be sent `overview_time` **local machine time** at which the day overview will be sent
### How to use ### ### How to use ###
Make sure you have installed all of dependencies and **filled settings.json properly**. You can also use `pip install -r requirements.txt` to install dependencies automatically. If you are using Raspberry Pi you won't have newest Python version installed, you can use [this guide](https://gist.github.com/dschep/24aa61672a2092246eaca2824400d37f). Make sure you have installed all of dependencies and **filled settings.json properly**. You can also use `pip install -r requirements.txt` to install dependencies automatically. If you are using Raspberry Pi you won't have newest Python version installed, you can use [this guide](https://gist.github.com/dschep/24aa61672a2092246eaca2824400d37f).

View file

@ -140,7 +140,7 @@ def webhook_formatter(action, STATIC, **params):
link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=article_encoded) link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=article_encoded)
embed["title"] = _("Deleted redirect {article} by overwriting").format(article=params["title"]) embed["title"] = _("Deleted redirect {article} by overwriting").format(article=params["title"])
elif action == 14: elif action == 14:
link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["targetlink"].replace(" ", "_")) link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["target"].replace(" ", "_"))
params["desc"] = "{supress}. {desc}".format(desc=params["desc"], supress=_("No redirect has been made") if params["supress"] == True else _("A redirect has been made")) params["desc"] = "{supress}. {desc}".format(desc=params["desc"], supress=_("No redirect has been made") if params["supress"] == True else _("A redirect has been made"))
embed["title"] = _("Moved {article} to {target}").format(article = params["title"], target=params["target"]) embed["title"] = _("Moved {article} to {target}").format(article = params["title"], target=params["target"])
elif action == 15: elif action == 15:
@ -629,10 +629,7 @@ if 1==2: #dummy for future translations
print (_("{wiki} is back up!")) print (_("{wiki} is back up!"))
if settings["overview"]: if settings["overview"]:
ovUTC_time = (time.strptime(settings["overview_UTC_time"], '%H:%M').tm_hour, time.strptime(settings["overview_UTC_time"], '%H:%M').tm_min) #i don't know what I did there schedule.every().day.at("{}:{}".format(time.strptime(settings["overview_time"], '%H:%M').tm_hour, time.strptime(settings["overview_time"], '%H:%M').tm_min)).do(day_overview)
diff = (datetime.datetime.now().hour - datetime.datetime.utcnow().hour, datetime.datetime.now().minute - datetime.datetime.utcnow().minute)
tim = (ovUTC_time[0]+diff[0], ovUTC_time[1]+diff[1])
schedule.every().day.at("{}:{}".format(int(math.fabs(tim[0])), int(math.fabs(tim[1])))).do(day_overview)
schedule.every().day.at("00:00").do(recent_changes.clear_cache) schedule.every().day.at("00:00").do(recent_changes.clear_cache)
while 1: while 1:

View file

@ -17,7 +17,7 @@
"verbose_level": 0, "verbose_level": 0,
"show_updown_messages": true, "show_updown_messages": true,
"overview": false, "overview": false,
"overview_UTC_time": "00:00", "overview_time": "00:00",
"appearance":{ "appearance":{
"daily_overview": { "daily_overview": {
"color": 16312092, "color": 16312092,