Class AutomatedBot<TBot, TAction>
The implementation of a bot that performs actions as operations.
Inheritance
Implements
Inherited Members
Namespace: Microsoft.XboxStudios.BotBrain.Operations
Assembly: BotBrain.Operations.dll
Syntax
public class AutomatedBot<TBot, TAction> : AutomatedBotBase<TAction>, IEventPublisher<BotActionEventArgs>, IBotWithEvents<TAction>, IBotWithEvents, IBotWithQueue<TAction>, IBotWithQueue, IAutomatedBot<TAction>, IAutomatedBot, IHasParameters, IDisposable where TBot : AutomatedBot<TBot, TAction>
Type Parameters
Name | Description |
---|---|
TBot | The bot type. |
TAction | The action type. |
Methods
View SourceGetOperation(TAction)
Gets the operation used to perform the given action.
Declaration
protected virtual IOperation<TBot> GetOperation(TAction action)
Parameters
Type | Name | Description |
---|---|---|
TAction | action | The action. |
Returns
Type | Description |
---|---|
IOperation<TBot> | The operation. |
StartExecution(IOperation<TBot>, CancellationToken)
Starts executing an operation on this bot.
Declaration
protected Task<bool> StartExecution(IOperation<TBot> operation, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
IOperation<TBot> | operation | The operation. |
CancellationToken | token | A token to monitor for cancellation. |
Returns
Type | Description |
---|---|
Task<bool> | True if the operation was successful. |
StartExecution<T>(IOperation<T>, T, CancellationToken)
Starts executing an operation on this bot.
Declaration
protected Task<bool> StartExecution<T>(IOperation<T> operation, T item, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
IOperation<T> | operation | The operation. |
T | item | The item to use. |
CancellationToken | token | A token to monitor for cancellation. |
Returns
Type | Description |
---|---|
Task<bool> | True if the operation was successful. |
Type Parameters
Name | Description |
---|---|
T | The context to run the operation in. |
StartOrResumeExecution(TAction, CancellationToken)
Starts executing the action on this bot, or waits for it to finish if it's already running.
Declaration
protected override Task<bool> StartOrResumeExecution(TAction operation, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
TAction | operation | The action. |
CancellationToken | token | A token to monitor for cancellation. |
Returns
Type | Description |
---|---|
Task<bool> | True if the operation was successful. |
Overrides
View SourceStartOrResumeExecution<T>(IOperation<T>, T, CancellationToken)
Starts executing an operation on this bot, or waits for it to finish if it's already running.
Declaration
protected Task<bool> StartOrResumeExecution<T>(IOperation<T> operation, T item, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
IOperation<T> | operation | The operation. |
T | item | The item to use. |
CancellationToken | token | A token to monitor for cancellation. |
Returns
Type | Description |
---|---|
Task<bool> | True if the operation was successful. |
Type Parameters
Name | Description |
---|---|
T | The context to run the operation in. |