mirror of
https://github.com/fishyboteso/fishyboteso.git
synced 2024-08-30 18:32:13 +00:00
Merge pull request #80 from fishyboteso/feature/active-count
active user feature
This commit is contained in:
commit
767417a0f7
@ -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__":
|
||||
|
23
fishy/helper/active_poll.py
Normal file
23
fishy/helper/active_poll.py
Normal 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)
|
@ -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):
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user