feat(bot): add interaction logging info for debugging with Discord
This commit is contained in:
parent
ee0a44f891
commit
580b4dfe7b
@ -1,5 +1,7 @@
|
|||||||
using Autofac;
|
using Autofac;
|
||||||
|
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
using Myriad.Gateway;
|
using Myriad.Gateway;
|
||||||
using Myriad.Types;
|
using Myriad.Types;
|
||||||
|
|
||||||
@ -9,17 +11,20 @@ public class InteractionCreated: IEventHandler<InteractionCreateEvent>
|
|||||||
{
|
{
|
||||||
private readonly InteractionDispatchService _interactionDispatch;
|
private readonly InteractionDispatchService _interactionDispatch;
|
||||||
private readonly ILifetimeScope _services;
|
private readonly ILifetimeScope _services;
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
public InteractionCreated(InteractionDispatchService interactionDispatch, ILifetimeScope services)
|
public InteractionCreated(InteractionDispatchService interactionDispatch, ILifetimeScope services, ILogger logger)
|
||||||
{
|
{
|
||||||
_interactionDispatch = interactionDispatch;
|
_interactionDispatch = interactionDispatch;
|
||||||
_services = services;
|
_services = services;
|
||||||
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Handle(int shardId, InteractionCreateEvent evt)
|
public async Task Handle(int shardId, InteractionCreateEvent evt)
|
||||||
{
|
{
|
||||||
if (evt.Type == Interaction.InteractionType.MessageComponent)
|
if (evt.Type == Interaction.InteractionType.MessageComponent)
|
||||||
{
|
{
|
||||||
|
_logger.Information($"Discord debug: got interaction with ID {evt.Id} from custom ID {evt.Data?.CustomId}");
|
||||||
var customId = evt.Data?.CustomId;
|
var customId = evt.Data?.CustomId;
|
||||||
if (customId == null) return;
|
if (customId == null) return;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user