Asks user to set their eth address after passing a check

This commit is contained in:
ThatBen 2025-04-23 09:04:23 +02:00
parent ac7aae972c
commit c630d4c81e
No known key found for this signature in database
GPG Key ID: 62C543548433D43E
2 changed files with 19 additions and 5 deletions

View File

@ -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();

View File

@ -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)