Merge pull request #80 from fishyboteso/feature/active-count

active user feature
This commit is contained in:
Adam Saudagar 2021-05-16 19:53:12 +05:30 committed by GitHub
commit 767417a0f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 0 deletions

View File

@ -13,6 +13,7 @@ from fishy.constants import chalutier, lam2
from fishy.engine.common.event_handler import EngineEventHandler
from fishy.gui import GUI, splash, update_dialog
from fishy.helper import hotkey
from fishy.helper.active_poll import active
from fishy.helper.config import config
@ -67,6 +68,7 @@ def initialize(window_to_hide):
def main():
active.init()
config.init()
splash.start()
print("launching please wait...")
@ -88,9 +90,11 @@ def main():
initialize(window_to_hide)
gui_window.start()
active.start()
bot.start_event_handler()
config.stop()
active.stop()
if __name__ == "__main__":

View File

@ -0,0 +1,23 @@
from event_scheduler import EventScheduler
from fishy.web import web
# noinspection PyPep8Naming
class active:
_scheduler: EventScheduler = None
@staticmethod
def init():
if active._scheduler:
return
active._scheduler = EventScheduler()
active._scheduler.start()
@staticmethod
def start():
active._scheduler.enter_recurring(60, 1, web.ping)
@staticmethod
def stop():
active._scheduler.stop(hard_stop=True)

View File

@ -15,6 +15,7 @@ session = domain + "/api/session"
terms = domain + "/terms.html"
discord = domain + "/api/discord"
beta = domain + "/api/beta"
ping = domain + "/api/ping"
def get_notification_page(uid):

View File

@ -141,3 +141,9 @@ def has_beta():
return False
return response.json()["beta"]
@fallback(None)
def ping():
body = {"uid": config.get("uid"), "apiversion": apiversion}
requests.post(urls.ping, params=body)