give registered role after modifying interaction

This commit is contained in:
Stanley Dimant
2025-01-03 13:19:26 +01:00
parent c73a810152
commit f047435ad9
2 changed files with 8 additions and 3 deletions

View File

@@ -104,6 +104,7 @@ public partial class MareWizardModule
ComponentBuilder cb = new(); ComponentBuilder cb = new();
bool stillEnqueued = _botServices.VerificationQueue.Any(k => k.Key == Context.User.Id); bool stillEnqueued = _botServices.VerificationQueue.Any(k => k.Key == Context.User.Id);
bool verificationRan = _botServices.DiscordVerifiedUsers.TryGetValue(Context.User.Id, out bool verified); bool verificationRan = _botServices.DiscordVerifiedUsers.TryGetValue(Context.User.Id, out bool verified);
bool registerSuccess = false;
if (!verificationRan) if (!verificationRan)
{ {
if (stillEnqueued) if (stillEnqueued)
@@ -144,8 +145,7 @@ public partial class MareWizardModule
+ Environment.NewLine + Environment.NewLine
+ "Have fun."); + "Have fun.");
AddHome(cb); AddHome(cb);
registerSuccess = true;
await _botServices.AddRegisteredRoleAsync(Context.Interaction.User).ConfigureAwait(false);
} }
else else
{ {
@@ -168,6 +168,8 @@ public partial class MareWizardModule
} }
await ModifyInteraction(eb, cb).ConfigureAwait(false); await ModifyInteraction(eb, cb).ConfigureAwait(false);
if (registerSuccess)
await _botServices.AddRegisteredRoleAsync(Context.Interaction.User).ConfigureAwait(false);
} }
private async Task<(bool, string)> HandleRegisterModalAsync(EmbedBuilder embed, LodestoneModal arg) private async Task<(bool, string)> HandleRegisterModalAsync(EmbedBuilder embed, LodestoneModal arg)

View File

@@ -95,6 +95,7 @@ public partial class MareWizardModule
ComponentBuilder cb = new(); ComponentBuilder cb = new();
bool stillEnqueued = _botServices.VerificationQueue.Any(k => k.Key == Context.User.Id); bool stillEnqueued = _botServices.VerificationQueue.Any(k => k.Key == Context.User.Id);
bool verificationRan = _botServices.DiscordVerifiedUsers.TryGetValue(Context.User.Id, out bool verified); bool verificationRan = _botServices.DiscordVerifiedUsers.TryGetValue(Context.User.Id, out bool verified);
bool relinkSuccess = false;
if (!verificationRan) if (!verificationRan)
{ {
if (stillEnqueued) if (stillEnqueued)
@@ -130,7 +131,7 @@ public partial class MareWizardModule
+ "Have fun."); + "Have fun.");
AddHome(cb); AddHome(cb);
await _botServices.AddRegisteredRoleAsync(Context.Interaction.User).ConfigureAwait(false); relinkSuccess = true;
} }
else else
{ {
@@ -147,6 +148,8 @@ public partial class MareWizardModule
} }
await ModifyInteraction(eb, cb).ConfigureAwait(false); await ModifyInteraction(eb, cb).ConfigureAwait(false);
if (relinkSuccess)
await _botServices.AddRegisteredRoleAsync(Context.Interaction.User).ConfigureAwait(false);
} }
private async Task<(bool Success, string LodestoneAuth, string UID)> HandleRelinkModalAsync(EmbedBuilder embed, LodestoneModal arg) private async Task<(bool Success, string LodestoneAuth, string UID)> HandleRelinkModalAsync(EmbedBuilder embed, LodestoneModal arg)