mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-10 07:47:53 +00:00
feat: initial 6-character HID rework
This commit is contained in:
parent
73f43b8cb3
commit
9f56697241
30 changed files with 208 additions and 91 deletions
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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() });
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue