mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
feat: upgrade to .NET 6, refactor everything
This commit is contained in:
parent
d28e99ba43
commit
1918c56937
314 changed files with 27954 additions and 27966 deletions
|
|
@ -1,33 +1,30 @@
|
|||
using System.Threading.Tasks;
|
||||
|
||||
using Autofac;
|
||||
|
||||
using Myriad.Gateway;
|
||||
using Myriad.Types;
|
||||
|
||||
namespace PluralKit.Bot
|
||||
namespace PluralKit.Bot;
|
||||
|
||||
public class InteractionCreated: IEventHandler<InteractionCreateEvent>
|
||||
{
|
||||
public class InteractionCreated: IEventHandler<InteractionCreateEvent>
|
||||
private readonly InteractionDispatchService _interactionDispatch;
|
||||
private readonly ILifetimeScope _services;
|
||||
|
||||
public InteractionCreated(InteractionDispatchService interactionDispatch, ILifetimeScope services)
|
||||
{
|
||||
private readonly InteractionDispatchService _interactionDispatch;
|
||||
private readonly ILifetimeScope _services;
|
||||
_interactionDispatch = interactionDispatch;
|
||||
_services = services;
|
||||
}
|
||||
|
||||
public InteractionCreated(InteractionDispatchService interactionDispatch, ILifetimeScope services)
|
||||
public async Task Handle(Shard shard, InteractionCreateEvent evt)
|
||||
{
|
||||
if (evt.Type == Interaction.InteractionType.MessageComponent)
|
||||
{
|
||||
_interactionDispatch = interactionDispatch;
|
||||
_services = services;
|
||||
}
|
||||
|
||||
public async Task Handle(Shard shard, InteractionCreateEvent evt)
|
||||
{
|
||||
if (evt.Type == Interaction.InteractionType.MessageComponent)
|
||||
var customId = evt.Data?.CustomId;
|
||||
if (customId != null)
|
||||
{
|
||||
var customId = evt.Data?.CustomId;
|
||||
if (customId != null)
|
||||
{
|
||||
var ctx = new InteractionContext(evt, _services);
|
||||
await _interactionDispatch.Dispatch(customId, ctx);
|
||||
}
|
||||
var ctx = new InteractionContext(evt, _services);
|
||||
await _interactionDispatch.Dispatch(customId, ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue