Skip to content

Commit

Permalink
Fix minor bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
MycroftKang committed Sep 25, 2024
1 parent f8e54c3 commit c938c4d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/bot/core/controllers/discord/dday.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ async def notify():
[
{
"name": "Time",
"value": f"{data.date.strftime('%I:%M %p')} ({data.offset})",
"value": f"{data.date.strftime('%Y-%m-%d %I:%M %p')} ({data.offset})",
},
{
"name": "Author",
Expand Down Expand Up @@ -235,7 +235,7 @@ async def set(
},
{
"name": "Time",
"value": f"{data.date.strftime('%I:%M %p')} ({data.offset})",
"value": f"{data.date.strftime('%Y-%m-%d %I:%M %p')} ({data.offset})",
},
],
),
Expand Down
15 changes: 8 additions & 7 deletions src/bot/discord_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@
from mgylabs.i18n.utils import get_user_locale_code, init_user_locale
from mgylabs.services.telemetry_service import TelemetryReporter
from mgylabs.utils import logger
from mgylabs.utils.config import CONFIG, MGCERT_PATH, VERSION, is_development_mode
from mgylabs.utils.config import (
CONFIG,
MGCERT_PATH,
SERVER_MODE,
VERSION,
is_development_mode,
)
from mgylabs.utils.helper import usage_helper
from mgylabs.utils.LogEntry import DiscordRequestLogEntry
from release import ReleaseNotify
Expand Down Expand Up @@ -305,7 +311,7 @@ async def create_bot(return_error_level=False):

@bot.event
async def on_ready():
TelemetryReporter.start("Login")
TelemetryReporter.start("Login", {"server_mode": SERVER_MODE})

print("Logged in within {:0.2f}s".format(time.time() - stime))

Expand Down Expand Up @@ -342,11 +348,6 @@ async def on_ready():

AppCommandDict.parse(cmds)

TelemetryReporter.Event(
"AppCommandSynced",
{"cmds": [{"id": c.id, "name": c.name} for c in cmds]},
)

synced = True

if not pending:
Expand Down
4 changes: 2 additions & 2 deletions src/lib/mgylabs/services/telemetry_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ def Exception(cls, error, properties={}, callback=None):
cls._run_callback_(callback)

@classmethod
def start(cls, callback_event_name=None):
def start(cls, callback_event_name=None, properties={}):
if telemetry_enabled and VERSION.is_release_build() and cls.reporter is None:
cls.reporter = TelemetryClient(INSIGHTS_APPLICATION_KEY, str(VERSION))

if callback_event_name is not None:
cls.Event(str(callback_event_name))
cls.Event(str(callback_event_name), properties)

@classmethod
def terminate(cls):
Expand Down
2 changes: 2 additions & 0 deletions src/lib/mgylabs/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

LOCALAPPDATA = os.getenv("LOCALAPPDATA")

SERVER_MODE = "--schtasks" in sys.argv


def is_development_mode(debug_mode=True):
return not getattr(sys, "frozen", False) or debug_mode and ("--debug") in sys.argv
Expand Down

0 comments on commit c938c4d

Please sign in to comment.