bind interaction to module

This commit is contained in:
rootdarkarchon
2022-10-20 14:29:11 +02:00
parent feb3cf328f
commit 54dd0b0f6e
4 changed files with 10 additions and 4 deletions

View File

@@ -54,6 +54,12 @@ internal class DiscordBot : IHostedService
await interactionModule.AddModuleAsync(typeof(MareModule), _services).ConfigureAwait(false);
await interactionModule.RegisterCommandsToGuildAsync(guild.Id, true).ConfigureAwait(false);
_discordClient.InteractionCreated += async (x) =>
{
var ctx = new SocketInteractionContext(_discordClient, x);
await interactionModule.ExecuteCommandAsync(ctx, _services);
};
_ = RemoveUsersNotInVanityRole();
}

View File

@@ -18,7 +18,7 @@ using System.Threading;
namespace MareSynchronosServices.Discord;
internal class DiscordBotServices
public class DiscordBotServices
{
public readonly ConcurrentQueue<SocketSlashCommand> verificationQueue = new();
public ConcurrentDictionary<ulong, DateTime> LastVanityChange = new();

View File

@@ -17,7 +17,7 @@ using MareSynchronosServices.Identity;
namespace MareSynchronosServices.Discord;
internal class LodestoneModal : IModal
public class LodestoneModal : IModal
{
public string Title => "Verify with Lodestone";
@@ -26,7 +26,7 @@ internal class LodestoneModal : IModal
public string LodestoneUrl { get; set; }
}
internal class MareModule : InteractionModuleBase
public class MareModule : InteractionModuleBase
{
private readonly IServiceProvider _services;
private readonly DiscordBotServices _botServices;