Fixed some warnings
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using PluginManager.Interfaces;
|
using PluginManager.Interfaces;
|
||||||
using PluginManager.Loaders;
|
using PluginManager.Loaders;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ namespace DiscordBot
|
|||||||
string assemblyPath = Path.Combine(folderPath, new AssemblyName(args.Name).Name + ".dll");
|
string assemblyPath = Path.Combine(folderPath, new AssemblyName(args.Name).Name + ".dll");
|
||||||
if (!File.Exists(assemblyPath)) return null;
|
if (!File.Exists(assemblyPath)) return null;
|
||||||
Assembly assembly = Assembly.LoadFrom(assemblyPath);
|
Assembly assembly = Assembly.LoadFrom(assemblyPath);
|
||||||
|
|
||||||
return assembly;
|
return assembly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,9 +47,7 @@ internal class CommandHandler
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var plugin = PluginLoader.SlashCommands!
|
var plugin = PluginLoader.SlashCommands!.FirstOrDefault(p => p.Name == arg.Data.Name);
|
||||||
.Where(p => p.Name == arg.Data.Name)
|
|
||||||
.FirstOrDefault();
|
|
||||||
|
|
||||||
if (plugin is null)
|
if (plugin is null)
|
||||||
throw new Exception("Failed to run command. !");
|
throw new Exception("Failed to run command. !");
|
||||||
@@ -98,7 +96,7 @@ internal class CommandHandler
|
|||||||
|
|
||||||
await commandService.ExecuteAsync(context, argPos, null);
|
await commandService.ExecuteAsync(context, argPos, null);
|
||||||
|
|
||||||
DBCommand plugin;
|
DBCommand? plugin;
|
||||||
string cleanMessage = "";
|
string cleanMessage = "";
|
||||||
|
|
||||||
if (message.HasMentionPrefix(client.CurrentUser, ref argPos))
|
if (message.HasMentionPrefix(client.CurrentUser, ref argPos))
|
||||||
@@ -132,7 +130,7 @@ internal class CommandHandler
|
|||||||
|
|
||||||
string[] split = cleanMessage.Split(' ');
|
string[] split = cleanMessage.Split(' ');
|
||||||
|
|
||||||
string[] argsClean = null;
|
string[]? argsClean = null;
|
||||||
if(split.Length > 1)
|
if(split.Length > 1)
|
||||||
argsClean = string.Join(' ', split, 1, split.Length-1).Split(' ');
|
argsClean = string.Join(' ', split, 1, split.Length-1).Split(' ');
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace PluginManager.Others
|
|||||||
public string commandUsed { get;init; }
|
public string commandUsed { get;init; }
|
||||||
public string[]? arguments { get;init; }
|
public string[]? arguments { get;init; }
|
||||||
|
|
||||||
public DBCommandExecutingArguments(SocketCommandContext context, string cleanContent, string commandUsed, string[] arguments)
|
public DBCommandExecutingArguments(SocketCommandContext context, string cleanContent, string commandUsed, string[]? arguments)
|
||||||
{
|
{
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.cleanContent = cleanContent;
|
this.cleanContent = cleanContent;
|
||||||
|
|||||||
Reference in New Issue
Block a user