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

    Class InteractiveExtensions

    Set of helper methods to make work with IWolfClient combined with IInteractiveListener<T> easier.

    Inheritance
    System.Object
    InteractiveExtensions
    Namespace: TehGM.Wolfringo
    Assembly: Wolfringo.Utilities.Interactive.dll
    Syntax
    public static class InteractiveExtensions

    Methods

    | Improve this Doc View Source

    AwaitNextAsync<T>(IWolfClient, Func<T, Boolean>, CancellationToken)

    Awaits next message of given type that matches specified conditions.

    Declaration
    public static Task<T> AwaitNextAsync<T>(this IWolfClient client, Func<T, bool> conditions, CancellationToken cancellationToken = default(CancellationToken))
        where T : IWolfMessage
    Parameters
    Type Name Description
    IWolfClient client

    Client to await message from.

    System.Func<T, System.Boolean> conditions

    Conditions that received message needs to match.

    System.Threading.CancellationToken cancellationToken

    Token that can cancel the awaiting.

    Returns
    Type Description
    System.Threading.Tasks.Task<T>

    Next message.

    Type Parameters
    Name Description
    T
    See Also
    AwaitNextInGroupAsync(IWolfClient, UInt32, CancellationToken)
    AwaitNextGroupByUserAsync(IWolfClient, UInt32, UInt32, CancellationToken)
    AwaitNextPrivateByUserAsync(IWolfClient, UInt32, CancellationToken)
    | Improve this Doc View Source

    AwaitNextAsync<T>(IWolfClient, Func<T, Boolean>, TimeSpan, CancellationToken)

    Awaits next message of given type that matches specified conditions.

    Declaration
    public static async Task<T> AwaitNextAsync<T>(this IWolfClient client, Func<T, bool> conditions, TimeSpan timeout, CancellationToken cancellationToken = default(CancellationToken))
        where T : IWolfMessage
    Parameters
    Type Name Description
    IWolfClient client

    Client to await message from.

    System.Func<T, System.Boolean> conditions

    Conditions that received message needs to match.

    System.TimeSpan timeout

    Timeout after which waiting will be aborted.

    System.Threading.CancellationToken cancellationToken

    Token that can cancel the awaiting.

    Returns
    Type Description
    System.Threading.Tasks.Task<T>

    Next message.

    Type Parameters
    Name Description
    T
    Remarks

    This method actually uses a System.Threading.CancellationTokenSource under the hood, and simply cancels the token after specified timeout.

    If the task is cancelled a default (most likely null> value will be returned. System.Threading.Tasks.TaskCanceledException will not be thrown.

    See Also
    AwaitNextGroupByUserAsync(IWolfClient, UInt32, UInt32, TimeSpan, CancellationToken)
    AwaitNextInGroupAsync(IWolfClient, UInt32, TimeSpan, CancellationToken)
    AwaitNextPrivateByUserAsync(IWolfClient, UInt32, TimeSpan, CancellationToken)
    | Improve this Doc View Source

    AwaitNextGroupByUserAsync(IWolfClient, UInt32, UInt32, CancellationToken)

    Awaits next chat message in specified group from specified user.

    Declaration
    public static Task<ChatMessage> AwaitNextGroupByUserAsync(this IWolfClient client, uint userID, uint groupID, CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    IWolfClient client

    Client to await message from.

    System.UInt32 userID

    User ID to await the message from.

    System.UInt32 groupID

    Group ID to await the message from.

    System.Threading.CancellationToken cancellationToken

    Token that can cancel the awaiting.

    Returns
    Type Description
    System.Threading.Tasks.Task<ChatMessage>

    Next message.

    See Also
    AwaitNextInGroupAsync(IWolfClient, UInt32, CancellationToken)
    AwaitNextPrivateByUserAsync(IWolfClient, UInt32, CancellationToken)
    AwaitNextAsync<T>(IWolfClient, Func<T, Boolean>, CancellationToken)
    | Improve this Doc View Source

    AwaitNextGroupByUserAsync(IWolfClient, UInt32, UInt32, TimeSpan, CancellationToken)

    Awaits next chat message in specified group from specified user.

    Declaration
    public static Task<ChatMessage> AwaitNextGroupByUserAsync(this IWolfClient client, uint userID, uint groupID, TimeSpan timeout, CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    IWolfClient client

    Client to await message from.

    System.UInt32 userID

    User ID to await the message from.

    System.UInt32 groupID

    Group ID to await the message from.

    System.TimeSpan timeout

    Timeout after which waiting will be aborted.

    System.Threading.CancellationToken cancellationToken

    Token that can cancel the awaiting.

    Returns
    Type Description
    System.Threading.Tasks.Task<ChatMessage>

    Next message.

    Remarks

    This method actually uses a System.Threading.CancellationTokenSource under the hood, and simply cancels the token after specified timeout.

    If the task is cancelled a default (most likely null> value will be returned. System.Threading.Tasks.TaskCanceledException will not be thrown.

    See Also
    AwaitNextAsync<T>(IWolfClient, Func<T, Boolean>, TimeSpan, CancellationToken)
    AwaitNextInGroupAsync(IWolfClient, UInt32, TimeSpan, CancellationToken)
    AwaitNextPrivateByUserAsync(IWolfClient, UInt32, TimeSpan, CancellationToken)
    | Improve this Doc View Source

    AwaitNextInGroupAsync(IWolfClient, UInt32, CancellationToken)

    Awaits next chat message in specified group.

    Declaration
    public static Task<ChatMessage> AwaitNextInGroupAsync(this IWolfClient client, uint groupID, CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    IWolfClient client

    Client to await message from.

    System.UInt32 groupID

    Group ID to await the message from.

    System.Threading.CancellationToken cancellationToken

    Token that can cancel the awaiting.

    Returns
    Type Description
    System.Threading.Tasks.Task<ChatMessage>

    Next message.

    See Also
    AwaitNextPrivateByUserAsync(IWolfClient, UInt32, CancellationToken)
    AwaitNextGroupByUserAsync(IWolfClient, UInt32, UInt32, CancellationToken)
    AwaitNextAsync<T>(IWolfClient, Func<T, Boolean>, CancellationToken)
    | Improve this Doc View Source

    AwaitNextInGroupAsync(IWolfClient, UInt32, TimeSpan, CancellationToken)

    Awaits next chat message in specified group.

    Declaration
    public static Task<ChatMessage> AwaitNextInGroupAsync(this IWolfClient client, uint groupID, TimeSpan timeout, CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    IWolfClient client

    Client to await message from.

    System.UInt32 groupID

    Group ID to await the message from.

    System.TimeSpan timeout

    Timeout after which waiting will be aborted.

    System.Threading.CancellationToken cancellationToken

    Token that can cancel the awaiting.

    Returns
    Type Description
    System.Threading.Tasks.Task<ChatMessage>

    Next message.

    Remarks

    This method actually uses a System.Threading.CancellationTokenSource under the hood, and simply cancels the token after specified timeout.

    If the task is cancelled a default (most likely null> value will be returned. System.Threading.Tasks.TaskCanceledException will not be thrown.

    See Also
    AwaitNextAsync<T>(IWolfClient, Func<T, Boolean>, TimeSpan, CancellationToken)
    AwaitNextGroupByUserAsync(IWolfClient, UInt32, UInt32, TimeSpan, CancellationToken)
    AwaitNextPrivateByUserAsync(IWolfClient, UInt32, TimeSpan, CancellationToken)
    | Improve this Doc View Source

    AwaitNextPrivateByUserAsync(IWolfClient, UInt32, CancellationToken)

    Awaits next chat message in PM from specified user.

    Declaration
    public static Task<ChatMessage> AwaitNextPrivateByUserAsync(this IWolfClient client, uint userID, CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    IWolfClient client

    Client to await message from.

    System.UInt32 userID

    User ID to await the message from.

    System.Threading.CancellationToken cancellationToken

    Token that can cancel the awaiting.

    Returns
    Type Description
    System.Threading.Tasks.Task<ChatMessage>

    Next message.

    See Also
    AwaitNextInGroupAsync(IWolfClient, UInt32, CancellationToken)
    AwaitNextGroupByUserAsync(IWolfClient, UInt32, UInt32, CancellationToken)
    AwaitNextAsync<T>(IWolfClient, Func<T, Boolean>, CancellationToken)
    | Improve this Doc View Source

    AwaitNextPrivateByUserAsync(IWolfClient, UInt32, TimeSpan, CancellationToken)

    Awaits next chat message in PM from specified user.

    Declaration
    public static Task<ChatMessage> AwaitNextPrivateByUserAsync(this IWolfClient client, uint userID, TimeSpan timeout, CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    IWolfClient client

    Client to await message from.

    System.UInt32 userID

    User ID to await the message from.

    System.TimeSpan timeout

    Timeout after which waiting will be aborted.

    System.Threading.CancellationToken cancellationToken

    Token that can cancel the awaiting.

    Returns
    Type Description
    System.Threading.Tasks.Task<ChatMessage>

    Next message.

    Remarks

    This method actually uses a System.Threading.CancellationTokenSource under the hood, and simply cancels the token after specified timeout.

    If the task is cancelled a default (most likely null> value will be returned. System.Threading.Tasks.TaskCanceledException will not be thrown.

    See Also
    AwaitNextAsync<T>(IWolfClient, Func<T, Boolean>, TimeSpan, CancellationToken)
    AwaitNextGroupByUserAsync(IWolfClient, UInt32, UInt32, TimeSpan, CancellationToken)
    AwaitNextInGroupAsync(IWolfClient, UInt32, TimeSpan, CancellationToken)