Fixed some null errors

This commit is contained in:
2024-04-09 20:40:18 +03:00
parent 0323c888b3
commit 123e8e90a1
5 changed files with 18 additions and 19 deletions

View File

@@ -6,6 +6,7 @@ using Discord.Commands;
using Discord.WebSocket;
using PluginManager.Interfaces;
using PluginManager.Loaders;
using PluginManager.Online;
using PluginManager.Others;
using PluginManager.Others.Permissions;
@@ -13,9 +14,9 @@ namespace PluginManager.Bot;
internal class CommandHandler
{
private readonly string _botPrefix;
private readonly DiscordSocketClient _client;
private readonly CommandService _commandService;
private readonly string _botPrefix;
private readonly DiscordSocketClient _client;
private readonly CommandService _commandService;
/// <summary>
/// Command handler constructor
@@ -45,10 +46,10 @@ internal class CommandHandler
{
try
{
var plugin = PluginLoader.SlashCommands!.FirstOrDefault(p => p.Name == arg.Data.Name);
var plugin = PluginLoader.SlashCommands.FirstOrDefault(p => p.Name == arg.Data.Name);
if (plugin is null)
throw new Exception("Failed to run command. !");
throw new Exception("Failed to run command !");
if (arg.Channel is SocketDMChannel)