Merged projects with plugins and modules
This commit is contained in:
@@ -41,7 +41,7 @@ public class PluginLoader
|
||||
|
||||
if (_Client == null)
|
||||
{
|
||||
Application.CurrentApplication.Logger.Log("Discord client is null", this, LogType.ERROR);
|
||||
Application.CurrentApplication.Logger.Log("Discord client is null", this, LogType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class PluginLoader
|
||||
|
||||
private void FileLoadedException(FileLoaderResult result)
|
||||
{
|
||||
Application.CurrentApplication.Logger.Log(result.ErrorMessage, this, LogType.ERROR);
|
||||
Application.CurrentApplication.Logger.Log(result.ErrorMessage, this, LogType.Error);
|
||||
}
|
||||
|
||||
private async void OnPluginLoaded(PluginLoadResultData result)
|
||||
@@ -71,10 +71,10 @@ public class PluginLoader
|
||||
{
|
||||
case PluginType.ACTION:
|
||||
ICommandAction action = (ICommandAction)result.Plugin;
|
||||
if (action.RunType == InternalActionRunType.ON_STARTUP || action.RunType == InternalActionRunType.BOTH)
|
||||
if (action.RunType == InternalActionRunType.OnStartup || action.RunType == InternalActionRunType.OnStartupAndCall)
|
||||
action.Execute(null);
|
||||
|
||||
if(action.RunType == InternalActionRunType.ON_CALL || action.RunType == InternalActionRunType.BOTH)
|
||||
if(action.RunType == InternalActionRunType.OnCall || action.RunType == InternalActionRunType.OnStartupAndCall)
|
||||
Actions.Add(action);
|
||||
|
||||
OnActionLoaded?.Invoke(result);
|
||||
@@ -101,11 +101,11 @@ public class PluginLoader
|
||||
OnSlashCommandLoaded?.Invoke(result);
|
||||
}
|
||||
else
|
||||
Application.CurrentApplication.Logger.Log($"Failed to start slash command {result.PluginName}", this, LogType.ERROR);
|
||||
Application.CurrentApplication.Logger.Log($"Failed to start slash command {result.PluginName}", this, LogType.Error);
|
||||
break;
|
||||
case PluginType.UNKNOWN:
|
||||
default:
|
||||
Application.CurrentApplication.Logger.Log("Unknown plugin type", this, LogType.ERROR);
|
||||
Application.CurrentApplication.Logger.Log("Unknown plugin type", this, LogType.Error);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ internal static class PluginLoaderExtensions
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Application.CurrentApplication.Logger.Log($"Error starting event {dbEvent.Name}: {e.Message}", typeof(PluginLoader), LogType.ERROR);
|
||||
Application.CurrentApplication.Logger.Log($"Error starting event {dbEvent.Name}: {e.Message}", typeof(PluginLoader), LogType.Error);
|
||||
Application.CurrentApplication.Logger.LogException(e, typeof(PluginLoader));
|
||||
return false;
|
||||
}
|
||||
@@ -39,14 +39,14 @@ internal static class PluginLoaderExtensions
|
||||
if(pluginLoader._Client.Guilds.Count == 0) return;
|
||||
if (!ulong.TryParse(Application.CurrentApplication.ServerID, out _))
|
||||
{
|
||||
Application.CurrentApplication.Logger.Log("Invalid ServerID in config file. Can not reset specific guild commands", typeof(PluginLoader), LogType.ERROR);
|
||||
Application.CurrentApplication.Logger.Log("Invalid ServerID in config file. Can not reset specific guild commands", typeof(PluginLoader), LogType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
SocketGuild? guild = pluginLoader._Client.GetGuild(ulong.Parse(Application.CurrentApplication.ServerID));
|
||||
if(guild is null)
|
||||
{
|
||||
Application.CurrentApplication.Logger.Log("Failed to get guild with ID " + Application.CurrentApplication.ServerID, typeof(PluginLoader), LogType.ERROR);
|
||||
Application.CurrentApplication.Logger.Log("Failed to get guild with ID " + Application.CurrentApplication.ServerID, typeof(PluginLoader), LogType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ internal static class PluginLoaderExtensions
|
||||
SocketGuild? guild = pluginLoader._Client.GetGuild(result);
|
||||
if (guild is null)
|
||||
{
|
||||
Application.CurrentApplication.Logger.Log("Failed to get guild with ID " + Application.CurrentApplication.ServerID, typeof(PluginLoader), LogType.ERROR);
|
||||
Application.CurrentApplication.Logger.Log("Failed to get guild with ID " + Application.CurrentApplication.ServerID, typeof(PluginLoader), LogType.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ internal static class PluginLoaderExtensions
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Application.CurrentApplication.Logger.Log($"Error starting slash command {dbSlashCommand.Name}: {e.Message}", typeof(PluginLoader), LogType.ERROR);
|
||||
Application.CurrentApplication.Logger.Log($"Error starting slash command {dbSlashCommand.Name}: {e.Message}", typeof(PluginLoader), LogType.Error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user