Fixed an issue in Canary.cs

This commit is contained in:
Toastie (DCS Team) 2024-03-27 18:37:24 +13:00
parent 8157d92fdf
commit 64363d2e8b
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4

View file

@ -4,14 +4,14 @@ namespace Ellie.Canary;
/// <summary> /// <summary>
/// The base class which will be loaded as a module into EllieBot /// The base class which will be loaded as a module into EllieBot
/// Any user-defined snek has to inherit from this class. /// Any user-defined canary has to inherit from this class.
/// Sneks get instantiated ONLY ONCE during the loading, /// Canaries get instantiated ONLY ONCE during the loading,
/// and any snek commands will be executed on the same instance. /// and any canary commands will be executed on the same instance.
/// </summary> /// </summary>
public abstract class Snek : IAsyncDisposable public abstract class Canary : IAsyncDisposable
{ {
/// <summary> /// <summary>
/// Name of the snek. Defaults to the lowercase class name /// Name of the canary. Defaults to the lowercase class name
/// </summary> /// </summary>
public virtual string Name public virtual string Name
=> GetType().Name.ToLowerInvariant(); => GetType().Name.ToLowerInvariant();
@ -25,14 +25,14 @@ public abstract class Snek : IAsyncDisposable
=> string.Empty; => string.Empty;
/// <summary> /// <summary>
/// Executed once this snek has been instantiated and before any command is executed. /// Executed once this canary has been instantiated and before any command is executed.
/// </summary> /// </summary>
/// <returns>A <see cref="ValueTask"/> representing completion</returns> /// <returns>A <see cref="ValueTask"/> representing completion</returns>
public virtual ValueTask InitializeAsync() public virtual ValueTask InitializeAsync()
=> default; => default;
/// <summary> /// <summary>
/// Override to cleanup any resources or references which might hold this snek in memory /// Override to cleanup any resources or references which might hold this canary in memory
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public virtual ValueTask DisposeAsync() public virtual ValueTask DisposeAsync()
@ -83,8 +83,8 @@ public abstract class Snek : IAsyncDisposable
/// <summary> /// <summary>
/// This method is called after the command was found but not executed, /// This method is called after the command was found but not executed,
/// and can be used to prevent the command's execution. /// and can be used to prevent the command's execution.
/// The command information doesn't have to be from this snek as this method /// The command information doesn't have to be from this canary as this method
/// will be called when *any* command from any module or snek was found. /// will be called when *any* command from any module or canary was found.
/// You can choose to prevent the execution of the command by returning "true" value. /// You can choose to prevent the execution of the command by returning "true" value.
/// <para>Execution order:</para> /// <para>Execution order:</para>
/// <para> /// <para>
@ -95,7 +95,7 @@ public abstract class Snek : IAsyncDisposable
/// </para> /// </para>
/// </summary> /// </summary>
/// <param name="context">Command context</param> /// <param name="context">Command context</param>
/// <param name="moduleName">Name of the snek or module from which the command originates</param> /// <param name="moduleName">Name of the canary or module from which the command originates</param>
/// <param name="commandName">Name of the command which is about to be executed</param> /// <param name="commandName">Name of the command which is about to be executed</param>
/// <returns>A <see cref="ValueTask"/> representing whether the execution should be blocked</returns> /// <returns>A <see cref="ValueTask"/> representing whether the execution should be blocked</returns>
public virtual ValueTask<bool> ExecPreCommandAsync( public virtual ValueTask<bool> ExecPreCommandAsync(