feature_fitness_logger #16

Merged
AllfatherHatt merged 2 commits from feature_fitness_logger into master 2026-02-04 18:01:06 +01:00

View File

@ -42,12 +42,11 @@ class FitnessCog(commands.Cog):
if not content.startswith("!"): if not content.startswith("!"):
return return
cmdline = content[1:].strip() cmdline = content[1:].strip().lower()
if not cmdline: if not cmdline:
return return
cmd, *rest = cmdline.split(" ", 1) cmd, *rest = cmdline.split(" ", 1)
cmd = cmd.lower()
arg = rest[0].strip() if rest else "" arg = rest[0].strip() if rest else ""
if cmd == "getunits": if cmd == "getunits":
@ -68,7 +67,6 @@ class FitnessCog(commands.Cog):
) )
return return
activity = activity.lower()
path = self.activity_units_path(activity) path = self.activity_units_path(activity)
if not path.exists(): if not path.exists():
@ -88,7 +86,6 @@ class FitnessCog(commands.Cog):
) )
return return
activity = activity.lower()
path = self.activity_log_path(activity) path = self.activity_log_path(activity)
if not path.exists(): if not path.exists():
@ -105,11 +102,11 @@ class FitnessCog(commands.Cog):
parts = message.content[1:].strip().split() parts = message.content[1:].strip().split()
if len(parts) < 2: if len(parts) < 2:
await message.reply( await message.reply(
"Usage: `!<activity> <value> [unit]` (example: `!pushups 20 reps`)" "Usage: `!<activity> <value> [unit]` (example: `!pushups 20` or `!run 5 km`)"
) )
return return
activity = parts[0].lower() activity = parts[0]
try: try:
value = float(parts[1]) value = float(parts[1])
@ -119,7 +116,7 @@ class FitnessCog(commands.Cog):
) )
return return
unit = parts[2].lower() if len(parts) > 2 else "m" unit = parts[2] if len(parts) > 2 else "m"
timestamp = int(message.created_at.timestamp()) timestamp = int(message.created_at.timestamp())
username = message.author.name username = message.author.name