Wolfringo Wolfringo
Wolfringo Wolfringo
Wolfringo (c) 2020 TehGM
DocFX, DiscordFX theme.
Search Results for

    Class CommandMessageCallback<T>

    Event callback for received messages and events.

    Inheritance
    System.Object
    TypedMessageCallback<T>
    CommandMessageCallback<T>
    Implements
    IMessageCallback
    System.IEquatable<TypedMessageCallback<T>>
    Inherited Members
    TypedMessageCallback<T>.CallbackInfo
    TypedMessageCallback<T>.Equals(Object)
    TypedMessageCallback<T>.Equals(TypedMessageCallback<T>)
    TypedMessageCallback<T>.GetHashCode()
    Namespace: TehGM.Wolfringo.Utilities.Internal
    Assembly: Wolfringo.Core.dll
    Syntax
    public class CommandMessageCallback<T> : TypedMessageCallback<T>, IMessageCallback, IEquatable<TypedMessageCallback<T>> where T : IWolfMessage
    Type Parameters
    Name Description
    T
    Remarks

    This interface is designed to allow invoking callback conditionally. If TryInvoke(IWolfMessage) returns false, it doesn't meant invoking failed - it means that callback determined it should not invoke for the provided message.

    This callback will only invoke if message is of type T, and message's EventName is the same as the one provided in class constructor.

    Constructors

    | Improve this Doc View Source

    CommandMessageCallback(String, Action<T>)

    Creates callback instance.

    Declaration
    public CommandMessageCallback(string command, Action<T> callback)
    Parameters
    Type Name Description
    System.String command

    Command that must be matched for message to execute the callback.

    System.Action<T> callback

    Method to invoke when this callback invokes.

    Properties

    | Improve this Doc View Source

    Command

    Callback will be invoked for messages with command matching this value.

    Declaration
    public string Command { get; }
    Property Value
    Type Description
    System.String

    Methods

    | Improve this Doc View Source

    TryInvoke(IWolfMessage)

    Attempts to invoke the callback.

    Declaration
    public override bool TryInvoke(IWolfMessage message)
    Parameters
    Type Name Description
    IWolfMessage message

    Message to attempt invoking the callback for.

    Returns
    Type Description
    System.Boolean

    True if callback was invoked; otherwise false.

    Overrides
    TehGM.Wolfringo.Utilities.Internal.TypedMessageCallback<T>.TryInvoke(TehGM.Wolfringo.IWolfMessage)
    Remarks

    This callback will only invoke if message is of type T, and message's EventName is the same as the one provided in class constructor.

    Implements

    IMessageCallback
    System.IEquatable<T>