mirror of
https://github.com/Myxelium/Lunaris2.0.git
synced 2026-04-09 06:09:39 +00:00
Small fix
This commit is contained in:
@@ -90,7 +90,5 @@ public class PlayHandler : IRequestHandler<PlayCommand>
|
||||
await context.SendMessageAsync($"Couldn't read song information", _client);
|
||||
}
|
||||
}
|
||||
|
||||
_audioService.TrackStarted += OnTrackStarted;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using Lunaris2.Handler.GoodByeCommand;
|
||||
using Lunaris2.Handler.MusicPlayer.JoinCommand;
|
||||
using Lunaris2.Handler.MusicPlayer.DisconnectCommand;
|
||||
using Lunaris2.Handler.MusicPlayer.PauseCommand;
|
||||
using Lunaris2.Handler.MusicPlayer.PlayCommand;
|
||||
using Lunaris2.Handler.MusicPlayer.ResumeCommand;
|
||||
using Lunaris2.Handler.MusicPlayer.SkipCommand;
|
||||
using Lunaris2.Notification;
|
||||
using Lunaris2.SlashCommand;
|
||||
@@ -12,16 +13,18 @@ public class SlashCommandReceivedHandler(ISender mediator) : INotificationHandle
|
||||
{
|
||||
public async Task Handle(SlashCommandReceivedNotification notification, CancellationToken cancellationToken)
|
||||
{
|
||||
await notification.Message.DeferAsync();
|
||||
|
||||
switch (notification.Message.CommandName)
|
||||
{
|
||||
case Command.Hello.Name:
|
||||
await mediator.Send(new HelloCommand.HelloCommand(notification.Message), cancellationToken);
|
||||
case Command.Resume.Name:
|
||||
await mediator.Send(new ResumeCommand(notification.Message), cancellationToken);
|
||||
break;
|
||||
case Command.Goodbye.Name:
|
||||
await mediator.Send(new GoodbyeCommand(notification.Message), cancellationToken);
|
||||
case Command.Pause.Name:
|
||||
await mediator.Send(new PauseCommand(notification.Message), cancellationToken);
|
||||
break;
|
||||
case Command.Join.Name:
|
||||
await mediator.Send(new JoinCommand(notification.Message), cancellationToken);
|
||||
case Command.Disconnect.Name:
|
||||
await mediator.Send(new DisconnectCommand(notification.Message), cancellationToken);
|
||||
break;
|
||||
case Command.Play.Name:
|
||||
await mediator.Send(new PlayCommand(notification.Message), cancellationToken);
|
||||
|
||||
@@ -25,7 +25,7 @@ public class DiscordEventListener(DiscordSocketClient client, IServiceScopeFacto
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
|
||||
private async Task OnMessageReceivedAsync(SocketMessage arg)
|
||||
private Task OnMessageReceivedAsync(SocketMessage arg)
|
||||
{
|
||||
_ = Task.Run(() => Mediator.Publish(new MessageReceivedNotification(arg), _cancellationToken), _cancellationToken);
|
||||
return Task.CompletedTask;
|
||||
|
||||
@@ -10,6 +10,7 @@ using Lunaris2.SlashCommand;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Victoria.Node;
|
||||
|
||||
namespace Lunaris2;
|
||||
|
||||
@@ -41,8 +42,7 @@ public class Program
|
||||
|
||||
services
|
||||
.AddSingleton(client)
|
||||
.AddSingleton(commands)
|
||||
.AddMediatR(configuration => configuration.RegisterServicesFromAssembly(Assembly.GetExecutingAssembly()))
|
||||
.AddMediatR(mediatRServiceConfiguration => mediatRServiceConfiguration.RegisterServicesFromAssembly(Assembly.GetExecutingAssembly()))
|
||||
.AddSingleton<DiscordEventListener>()
|
||||
.AddSingleton(service => new InteractionService(service.GetRequiredService<DiscordSocketClient>()))
|
||||
.AddLavalink()
|
||||
@@ -63,7 +63,6 @@ public class Program
|
||||
client.Ready += () => Client_Ready(client);
|
||||
client.Log += Log;
|
||||
|
||||
|
||||
client
|
||||
.LoginAsync(TokenType.Bot, configuration["Token"])
|
||||
.GetAwaiter()
|
||||
|
||||
Reference in New Issue
Block a user