Merge pull request #50 from SemjonKerner/fix_notifications

Fix bug calling is_subbed
This commit is contained in:
Semjon Kerner 2021-03-26 12:41:07 +01:00 committed by GitHub
commit b157420d77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 8 deletions

View File

@ -33,7 +33,6 @@ class WindowClient:
WindowClient.clients.remove(self)
if len(WindowClient.clients) == 0:
window_server.stop()
logging.info("window server stopped")
@staticmethod
def running():

View File

@ -162,8 +162,12 @@ def on_loot():
def on_fight():
logging.info("FIGHTING")
msg = "FIGHTING!"
logging.info(msg)
web.send_notification(msg)
def on_dead():
logging.info("DEAD or INVENTORY FULL or NO BAIT EQUIPPED")
msg = "DEAD or INVENTORY FULL or NO BAIT EQUIPPED"
logging.info(msg)
web.send_notification(msg)

View File

@ -58,7 +58,7 @@ def start_semifisher_config(gui: 'GUI'):
gui.config.save_config()
def toggle_sub():
if web.is_subbed(config.get("uid"))[0]:
if web.is_subbed()[0]:
if web.unsub():
gui._notify.set(0)
else:

View File

@ -51,18 +51,20 @@ def register_user(new_uid):
@fallback(None)
def send_notification(uid, message):
# todo clean dead code
if not is_subbed(uid):
def send_notification(message):
if not is_subbed():
return False
body = {"uid": uid, "message": message, "apiversion":apiversion}
body = {"uid": config.get("uid"), "message": message, "apiversion":apiversion}
requests.post(urls.notify, json=body)
@uses_session
@fallback(None)
def send_hole_deplete(fish_caught, hole_time, fish_times):
if not is_subbed():
return False
hole_data = {
"fish_caught": fish_caught,
"hole_time": hole_time,