From 3ed04742d9b2cd797e74e4f16d16a94e24b1caea Mon Sep 17 00:00:00 2001 From: Seb Date: Mon, 29 Jan 2024 20:10:13 -0800 Subject: [PATCH] fit: remove old exp stuff --- bot/src/commands/fit/Fit.ts | 12 ++++------ bot/src/commands/fit/UserProfile.ts | 35 ----------------------------- 2 files changed, 4 insertions(+), 43 deletions(-) diff --git a/bot/src/commands/fit/Fit.ts b/bot/src/commands/fit/Fit.ts index bf6a023..6c666f2 100644 --- a/bot/src/commands/fit/Fit.ts +++ b/bot/src/commands/fit/Fit.ts @@ -11,7 +11,6 @@ import * as UserAuth from "./UserAuth"; import * as UserProfile from "./UserProfile"; // import * as ActivityWebhook from "./ActivityWebhook"; import * as Promotions from "./Promotions"; -import * as Leaders from "./Leaders"; import * as LastActive from "./LastActive"; // @ts-ignore @@ -30,9 +29,7 @@ const help = Format.help ({ usage: "!fit ", commands: { "auth": "Set up your strava account with the bot", - "profile": "View your progress and stats", - "leaders": "View the top 2 exp earners for each activity type", - "balance": "Check how balanced your XP" + "profile": "View your progress and stats" } }); @@ -45,9 +42,9 @@ const fit = Command.filtered ({ callback: message => match (Command.route (message)) .with ("auth", () => UserAuth.onBoarding (message)) - .with ("profile", () => UserProfile.render (message)) - .with ("balance", () => Balance.render (message)) - .with ("leaders", () => Leaders.leaderboard (message)) + .with ("profile", () => UserProfile.render(message)) + .with ("balance", () => message.reply("Balance will no longer work")) + .with ("leaders", () => message.reply("Leaderboard is out of date with new scoring, will be updated")) .with ("help", () => message.channel.send (help)) .with ("settings", () => message.reply ("Settings menu is available only in DMs")) .with (__.nullish, () => message.channel.send (help)) @@ -118,5 +115,4 @@ export const routes = (client: Discord.Client) => [ export const startup = (client: Discord.Client) : void => { LastActive.beginFlush (client); - Promotions.startSchedule (client); }; \ No newline at end of file diff --git a/bot/src/commands/fit/UserProfile.ts b/bot/src/commands/fit/UserProfile.ts index 6a88f0c..5813bec 100644 --- a/bot/src/commands/fit/UserProfile.ts +++ b/bot/src/commands/fit/UserProfile.ts @@ -37,41 +37,6 @@ export const render = async (message: Message) : Promise => { { name: "Rank", value: `${rank} (${score})`, inline: true }, { name: "Total EXP", value: Format.exp (user.xp), inline: true } ]); - - // All workouts in the last 30 days - const lastThirtyDays = Interval.before (DateTime.local (), { days: 30 }); - const workouts = await Workout.find (Workout.during (lastThirtyDays)); - - // User's workouts in the last 30 days - const profileWorkouts = workouts.filter (w => w.discord_id === user.discordId); - - // The start of the week, used for EXP promotion calculation - const weekStart = Week.current ().start.toUTC (); - - // Collection of workouts that apply to this week's promotion - const weekly = profileWorkouts.filter (w => w.timestamp >= weekStart.toISO ()); - embed.addFields ({ - name: "Weekly EXP", - value: Format.exp (Workout.exp (weekly)), - inline: true - }); - - // The user's most recently recorded workout - const mostRecentWorkout = option (profileWorkouts) - .map (list => list.sort ((a, b) => a.timestamp > b.timestamp ? -1 : 1)) - .flatMap (list => option (list[0])); - - mostRecentWorkout.map (workout => { - const emoji = EmojiSet.get (workout.activity_type, workout.exp, user.emojis); - const name = workout.activity_name; - const timeAgo = fromNow (workout.timestamp, { suffix: true, max: 1 }); - - embed.addFields ({ - name: "Last Activity", - value: `${emoji} ${name} • ${timeAgo}`, - inline: true - }); - }); message.channel.send ({ embeds: [embed] }); }; \ No newline at end of file