6 using Core.Commands.Results;
27 #region IMessageReceived
39 foreach (var topic
in topics) {
41 Error($
"Subscription failed: {ex.Message}");
42 Debug($
"Stacktrace: {ex.StackTrace}");
57 public void Information(
string? msg) =>
Logger?.Information($
"[{ Plugin.PluginName }] {msg}");
60 public void Debug(
string? msg) =>
Logger?.Debug($
"[{ Plugin.PluginName }] {msg}");
63 public void Error(
string? msg) =>
Logger?.Error($
"[{ Plugin.PluginName }] {msg}");
66 public void Warning(
string? msg) =>
Logger?.Warning($
"[{ Plugin.PluginName }] {msg}");
69 public void Trace(
string? msg) =>
Logger?.Verbose($
"[{ Plugin.PluginName }] {msg}");
Provides an application-wide, thread safe way of getting and setting configurations relevant to the m...
static ConfigManager Instance
Gets the application-wide instance of the ConfigManager.
EventArgs-derived class containing the event arguments for when a message was received on a given top...
Custom logger class for Hermod; internally uses Serilog.
Allows delegating topics and command execution requests from plugins through Hermod to other plugins.
void SubscribeTopic(string topicName)
Allows a plugin to subscribe to an individual topic.
void Information(string? msg)
Logs an information message to the logger.This will prefix the message with [name of plugin].
PluginDelegator(IPlugin plugin, ILogger? logger=null)
Instantiates a new instance of this class.
ICommandResult ExecuteCommand(params string[] command)
Executes a single command.If command execution has been disabled for this plugin, then a Exceptions....
void Trace(string? msg)
Logs a trace message to the logger.This will prefix the message with [name of plugin].
void Debug(string? msg)
Logs a debug message to the logger.This will prefix the message with [name of plugin].
T GetApplicationConfig< T >(string config)
Retrieves an application configuration value.The desired configuration.
void OnMessageReceived(MessageReceivedEventArgs e)
void Error(string? msg)
Logs an error message to the logger.This will prefix the message with [name of plugin].
void SubscribeTopics(params string[] topics)
Allows a plugin to subscribe to multiple individual topics.This method will fail silently and ignore ...
bool TryGetApplicationConfig< T >(string config, out T? value)
Tries to retrieve an application configuration value.true if retrieving the configuration was success...
void PublishMessage(string topic, object? message)
Allows a plugin to publish a message on a given topic.
void Warning(string? msg)
Logs a warning message to the logger.This will prefix the message with [name of plugin].
MessageReceivedEventHandler? MessageReceived
void UnsubscribeTopic(string topicName)
Allows a plugin to unsubscribe from a single topic.
An abstract class for plugins with all the main features already implemented.
Handles the loading, unloading, and general management of plugins.
void AddSubscription(IPlugin plugin, string topic)
Adds a plugin to a topic subscription list.
void RemoveSubscription(IPlugin plugin, string topic)
Removes a plugin from a topic subscription list.
static PluginRegistry Instance
Gets the current instance of this object.
A generic, object-based variation of ICommandResult<T>.
Basic contract between Hermod and any laoded plugins which allows jobs to be delegated to other plugi...
Basic contract between Hermod and any plugins.
delegate void MessageReceivedEventHandler(object? sender, MessageReceivedEventArgs e)
Event handler delegate for the MessageReceived event.