mirror of
https://gitlab.com/chicken-riders/RcGcDw.git
synced 2025-02-23 00:24:09 +00:00
Probably fixes #36, added version info on startup
This commit is contained in:
parent
f98546cc78
commit
5415273543
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue