More fixes to the new config. Module loader reworked

This commit is contained in:
2024-08-06 22:47:59 +03:00
parent 27e25a9166
commit 18a059af0e
51 changed files with 390 additions and 301 deletions

View File

@@ -107,7 +107,7 @@ public class App
if (arg.Message.Contains("401"))
{
Application.CurrentApplication.ApplicationEnvironmentVariables.Remove("token");
Application.CurrentApplication.Logger.Log("The token is invalid.", this, LogType.Critical);
Application.Logger.Log("The token is invalid.", this, LogType.Critical);
await Application.CurrentApplication.ApplicationEnvironmentVariables.SaveToFile();
await Task.Delay(3000);
@@ -124,7 +124,7 @@ public class App
private Task LoggedIn()
{
Application.CurrentApplication.Logger.Log("Successfully Logged In", this);
Application.Logger.Log("Successfully Logged In", this);
return Task.CompletedTask;
}
@@ -134,12 +134,12 @@ public class App
{
case LogSeverity.Error:
case LogSeverity.Critical:
Application.CurrentApplication.Logger.Log(message.Message, this, LogType.Error);
Application.Logger.Log(message.Message, this, LogType.Error);
break;
case LogSeverity.Info:
case LogSeverity.Debug:
Application.CurrentApplication.Logger.Log(message.Message, this, LogType.Info);
Application.Logger.Log(message.Message, this, LogType.Info);
break;

View File

@@ -51,12 +51,12 @@ internal class CommandHandler
throw new Exception("Failed to run command !");
if (arg.Channel is SocketDMChannel)
plugin.ExecuteDM(arg);
plugin.ExecuteDm(arg);
else plugin.ExecuteServer(arg);
}
catch (Exception ex)
{
Application.CurrentApplication.Logger.LogException(ex, this);
Application.Logger.LogException(ex, this);
}
return Task.CompletedTask;
@@ -91,7 +91,7 @@ internal class CommandHandler
await _commandService.ExecuteAsync(context, argPos, null);
DBCommand? plugin;
IDbCommand? plugin;
var cleanMessage = "";
if (message.HasMentionPrefix(_client.CurrentUser, ref argPos))
@@ -129,7 +129,7 @@ internal class CommandHandler
if (plugin is null)
return;
if (plugin.requireAdmin && !context.Message.Author.IsAdmin())
if (plugin.RequireAdmin && !context.Message.Author.IsAdmin())
return;
var split = cleanMessage.Split(' ');
@@ -140,19 +140,19 @@ internal class CommandHandler
DbCommandExecutingArguments cmd = new(context, cleanMessage, split[0], argsClean);
Application.CurrentApplication.Logger.Log(
Application.Logger.Log(
$"User ({context.User.Username}) from Guild \"{context.Guild.Name}\" executed command \"{cmd.CleanContent}\"",
this,
LogType.Info
);
if (context.Channel is SocketDMChannel)
plugin.ExecuteDM(cmd);
plugin.ExecuteDm(cmd);
else plugin.ExecuteServer(cmd);
}
catch (Exception ex)
{
Application.CurrentApplication.Logger.LogException(ex, this);
Application.Logger.LogException(ex, this);
}
}
}