Probably fixes #36, added version info on startup

This commit is contained in:
Frisk 2018-11-18 13:09:55 +01:00
parent f98546cc78
commit 5415273543
No known key found for this signature in database
GPG key ID: 0E9A7D3C0A01586C

View file

@ -39,7 +39,8 @@ logging.info("Current settings: {settings}".format(settings=settings))
lang = gettext.translation('rcgcdw', localedir='locale', languages=[settings["lang"]]) lang = gettext.translation('rcgcdw', localedir='locale', languages=[settings["lang"]])
lang.install() lang.install()
ngettext = lang.ngettext ngettext = lang.ngettext
version = "1.5"
print("RcGcDw version {} is starting...".format(version))
class MWError(Exception): class MWError(Exception):
pass pass
@ -97,9 +98,12 @@ def safe_read(request, *keys):
def send_to_discord_webhook(data): def send_to_discord_webhook(data):
header = settings["header"]
if "content" not in data:
header['Content-Type'] = 'application/json'
try: try:
result = requests.post(settings["webhookURL"], data=data, result = requests.post(settings["webhookURL"], data=data,
headers={**{'Content-Type': 'application/json'}, **settings["header"]}, timeout=10) headers=header, timeout=10)
except requests.exceptions.Timeout: except requests.exceptions.Timeout:
logging.warning("Timeouted while sending data to the webhook.") logging.warning("Timeouted while sending data to the webhook.")
return 3 return 3