feat: initial 6-character HID rework

This commit is contained in:
Iris System 2024-04-28 15:46:06 +12:00
parent 73f43b8cb3
commit 9f56697241
30 changed files with 208 additions and 91 deletions

View file

@ -16,20 +16,23 @@ public class InteractionCreated: IEventHandler<InteractionCreateEvent>
private readonly ApplicationCommandTree _commandTree;
private readonly ILifetimeScope _services;
private readonly ILogger _logger;
private readonly ModelRepository _repo;
public InteractionCreated(InteractionDispatchService interactionDispatch, ApplicationCommandTree commandTree,
ILifetimeScope services, ILogger logger)
ILifetimeScope services, ILogger logger, ModelRepository repo)
{
_interactionDispatch = interactionDispatch;
_commandTree = commandTree;
_services = services;
_logger = logger;
_repo = repo;
}
public async Task Handle(int shardId, InteractionCreateEvent evt)
{
var system = await _services.Resolve<ModelRepository>().GetSystemByAccount(evt.Member?.User.Id ?? evt.User!.Id);
var ctx = new InteractionContext(_services, evt, system);
var system = await _repo.GetSystemByAccount(evt.Member?.User.Id ?? evt.User!.Id);
var config = system != null ? await _repo.GetSystemConfig(system!.Id) : null;
var ctx = new InteractionContext(_services, evt, system, config);
switch (evt.Type)
{

View file

@ -175,6 +175,8 @@ public class ReactionAdded: IEventHandler<MessageReactionAddEvent>
private async ValueTask HandleQueryReaction(MessageReactionAddEvent evt, FullMessage msg)
{
var guild = await _cache.GetGuild(evt.GuildId!.Value);
var system = await _repo.GetSystemByAccount(evt.UserId);
var config = system != null ? await _repo.GetSystemConfig(system.Id) : null;
// Try to DM the user info about the message
try
@ -188,11 +190,12 @@ public class ReactionAdded: IEventHandler<MessageReactionAddEvent>
msg.System,
msg.Member,
guild,
config,
LookupContext.ByNonOwner,
DateTimeZone.Utc
));
embeds.Add(await _embeds.CreateMessageInfoEmbed(msg, true));
embeds.Add(await _embeds.CreateMessageInfoEmbed(msg, true, config));
await _rest.CreateMessage(dm, new MessageRequest { Embeds = embeds.ToArray() });
}