Fixed some names

This commit is contained in:
2023-12-27 18:24:32 +02:00
parent af90ae5fba
commit cc355d7d4f
2 changed files with 24 additions and 21 deletions

View File

@@ -13,9 +13,9 @@ namespace PluginManager.Bot;
internal class CommandHandler internal class CommandHandler
{ {
private readonly string botPrefix; private readonly string _botPrefix;
private readonly DiscordSocketClient client; private readonly DiscordSocketClient _client;
private readonly CommandService commandService; private readonly CommandService _commandService;
/// <summary> /// <summary>
/// Command handler constructor /// Command handler constructor
@@ -25,9 +25,9 @@ internal class CommandHandler
/// <param name="botPrefix">The prefix to watch for</param> /// <param name="botPrefix">The prefix to watch for</param>
public CommandHandler(DiscordSocketClient client, CommandService commandService, string botPrefix) public CommandHandler(DiscordSocketClient client, CommandService commandService, string botPrefix)
{ {
this.client = client; this._client = client;
this.commandService = commandService; this._commandService = commandService;
this.botPrefix = botPrefix; this._botPrefix = botPrefix;
} }
/// <summary> /// <summary>
@@ -36,9 +36,9 @@ internal class CommandHandler
/// <returns></returns> /// <returns></returns>
public async Task InstallCommandsAsync() public async Task InstallCommandsAsync()
{ {
client.MessageReceived += MessageHandler; _client.MessageReceived += MessageHandler;
client.SlashCommandExecuted += Client_SlashCommandExecuted; _client.SlashCommandExecuted += Client_SlashCommandExecuted;
await commandService.AddModulesAsync(Assembly.GetEntryAssembly(), null); await _commandService.AddModulesAsync(Assembly.GetEntryAssembly(), null);
} }
private Task Client_SlashCommandExecuted(SocketSlashCommand arg) private Task Client_SlashCommandExecuted(SocketSlashCommand arg)
@@ -85,19 +85,19 @@ internal class CommandHandler
var argPos = 0; var argPos = 0;
if (!message.Content.StartsWith(botPrefix) && !message.HasMentionPrefix(client.CurrentUser, ref argPos)) if (!message.Content.StartsWith(_botPrefix) && !message.HasMentionPrefix(_client.CurrentUser, ref argPos))
return; return;
var context = new SocketCommandContext(client, message); var context = new SocketCommandContext(_client, message);
await commandService.ExecuteAsync(context, argPos, null); await _commandService.ExecuteAsync(context, argPos, null);
DBCommand? plugin; DBCommand? plugin;
var cleanMessage = ""; var cleanMessage = "";
if (message.HasMentionPrefix(client.CurrentUser, ref argPos)) if (message.HasMentionPrefix(_client.CurrentUser, ref argPos))
{ {
var mentionPrefix = "<@" + client.CurrentUser.Id + ">"; var mentionPrefix = "<@" + _client.CurrentUser.Id + ">";
plugin = PluginLoader.Commands! plugin = PluginLoader.Commands!
.FirstOrDefault(plug => plug.Command == .FirstOrDefault(plug => plug.Command ==
@@ -119,14 +119,14 @@ internal class CommandHandler
{ {
plugin = PluginLoader.Commands! plugin = PluginLoader.Commands!
.FirstOrDefault(p => p.Command == .FirstOrDefault(p => p.Command ==
message.Content.Split(' ')[0].Substring(botPrefix.Length) || message.Content.Split(' ')[0].Substring(_botPrefix.Length) ||
(p.Aliases is not null && (p.Aliases is not null &&
p.Aliases.Contains( p.Aliases.Contains(
message.Content.Split(' ')[0] message.Content.Split(' ')[0]
.Substring(botPrefix.Length) .Substring(_botPrefix.Length)
)) ))
); );
cleanMessage = message.Content.Substring(botPrefix.Length); cleanMessage = message.Content.Substring(_botPrefix.Length);
} }
if (plugin is null) if (plugin is null)

View File

@@ -8,10 +8,13 @@ public static class UxHandler
public static void Init() public static void Init()
{ {
if (Config.AppSettings["UI"] == "KDE") _model = Config.AppSettings["UI"] switch
_model = new Linux.KDE(); {
else "KDE" => new Linux.KDE(),
_model = new Other.Console(); "Console" => new Other.Console(),
_ => _model
};
} }
public static async Task ShowMessageBox(string title, string message, MessageBoxType type = MessageBoxType.Info) public static async Task ShowMessageBox(string title, string message, MessageBoxType type = MessageBoxType.Info)