From c630d4c81ea2b0a5fb57abd05e7ebcc78074c391 Mon Sep 17 00:00:00 2001 From: ThatBen Date: Wed, 23 Apr 2025 09:04:23 +0200 Subject: [PATCH] Asks user to set their eth address after passing a check --- .../CodexChecking/CodexTwoWayChecker.cs | 4 ++-- .../Commands/CheckResponseHandler.cs | 20 ++++++++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/Tools/BiblioTech/CodexChecking/CodexTwoWayChecker.cs b/Tools/BiblioTech/CodexChecking/CodexTwoWayChecker.cs index c5b9361a..83175803 100644 --- a/Tools/BiblioTech/CodexChecking/CodexTwoWayChecker.cs +++ b/Tools/BiblioTech/CodexChecking/CodexTwoWayChecker.cs @@ -8,7 +8,7 @@ namespace BiblioTech.CodexChecking public interface ICheckResponseHandler { Task CheckNotStarted(); - Task NowCompleted(ulong userId, string checkName); + Task NowCompleted(string checkName); Task GiveRoleReward(); Task InvalidData(); @@ -192,7 +192,7 @@ namespace BiblioTech.CodexChecking private async Task CheckNowCompleted(ICheckResponseHandler handler, TransferCheck check, ulong userId, string checkName) { - await handler.NowCompleted(userId, checkName); + await handler.NowCompleted(checkName); check.CompletedUtc = DateTime.UtcNow; repo.SaveChanges(); diff --git a/Tools/BiblioTech/Commands/CheckResponseHandler.cs b/Tools/BiblioTech/Commands/CheckResponseHandler.cs index 5428e86b..f7b1c4f0 100644 --- a/Tools/BiblioTech/Commands/CheckResponseHandler.cs +++ b/Tools/BiblioTech/Commands/CheckResponseHandler.cs @@ -74,10 +74,24 @@ namespace BiblioTech.Commands await context.Followup("The received data didn't match. Check has failed."); } - public async Task NowCompleted(ulong userId, string checkName) + public async Task NowCompleted(string checkName) { - await context.Followup("Successfully completed the check!"); - await Program.AdminChecker.SendInAdminChannel($"User <@{userId}> has completed check: {checkName}"); + // check if eth address is known for user. + var data = Program.UserRepo.GetUser(user); + if (data.CurrentAddress == null) + { + await context.Followup($"Successfully completed the check!{Environment.NewLine}" + + $"You haven't yet set your ethereum address. Consider using '/set' to set it.{Environment.NewLine}" + + $"(You can find your address in the 'eth.address' file of your Codex node.)"); + + await Program.AdminChecker.SendInAdminChannel($"User <@{user.Id}> has completed check: {checkName}" + + $" - EthAddress not set for user. User was reminded."); + } + else + { + await context.Followup("Successfully completed the check!"); + await Program.AdminChecker.SendInAdminChannel($"User <@{user.Id}> has completed check: {checkName}"); + } } public async Task ToAdminChannel(string msg)