Skip to content

Commit 95f476b

Browse files
committed
feat: include tester hours played in Discord notification payload
1 parent 3bf1310 commit 95f476b

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

src/Services/NotificationService.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using DotEnv.Core;
2+
using Playtesters.API.Extensions;
23

34
namespace Playtesters.API.Services;
45

@@ -12,6 +13,7 @@ public record NotificationMessage(
1213
string IpAddress,
1314
string Country,
1415
string City,
16+
double HoursPlayed,
1517
DateTime Timestamp
1618
);
1719

@@ -46,12 +48,14 @@ public async Task SendAsync(NotificationMessage message)
4648

4749
var content =
4850
$"""
49-
🔔 *New validated access*
51+
🔔 *New validated access:*
5052
👤 Tester: **{message.TesterName}**
5153
🌐 IP: `{message.IpAddress}`
5254
🌍 Country: {message.Country}
5355
🏙️ City: {message.City}
56+
⏳ Hours played: {message.HoursPlayed.ToHhMmSs()}
5457
{message.Timestamp:yyyy-MM-dd HH:mm:ss}
58+
5559
""";
5660

5761
try

src/UseCases/Testers/ValidateAccess.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public async Task<Result<ValidateTesterAccessResponse>> ExecuteAsync(
6565
IpAddress: ipAddress,
6666
Country: location.Country,
6767
City: location.City,
68+
HoursPlayed: tester.TotalHoursPlayed,
6869
Timestamp: accessHistory.CheckedAt
6970
);
7071
await notificationService.SendAsync(notificationMessage);

0 commit comments

Comments
 (0)