SmartTasker
Introduction
SmartTasker
is a comprehensive class designed for task management within bot applications. It offers a robust framework for handling tasks, tracking user progress, managing rewards, and more. This guide provides an overview of the SmartTasker
class, explaining its core functionalities and how to effectively integrate it into your bot projects.
We have bot demo: BBDemoTaskBot - free available in the Store.
Key Features
Task Management: Manages a list of tasks and user interactions with these tasks.
Progress Tracking: Keeps track of user's completed and ongoing tasks.
Reward System: Manages a balance system for rewarding users upon task completion.
Dynamic Task Execution: Supports dynamic handling and execution of tasks based on user input and actions.
Constructor
The constructor initializes the SmartTasker
with necessary configurations.
Syntax:
Parameters:
options
: An object containing initial settings such as task list, balance, and a reference toSmartBot
.
Example:
Core Methods
getTasksForWork
Fetches tasks available for the user to work on.
Usage:
skipTask
Skips the current task and moves to the next one.
Usage:
defineTask
Defines the current task based on the task ID or task definition.
Usage:
completeExecution
Marks the current task as completed and processes the reward.
Usage:
addBalance
Adds a specified amount to the user's balance.
Usage:
prepareTaskQuestion
Prepares a question related to a task for user interaction.
Usage:
acceptAnswer
Processes the user's answer to a task question.
Usage:
Best Practices
Consistency in Task Definitions: Ensure that tasks are defined consistently and include all necessary information.
Error Handling: Utilize the built-in error handling capabilities of
SmartTasker
to manage exceptions and provide feedback to users.Integration with SmartBot: Leverage the integration with
SmartBot
for a seamless user experience.Task Progress Persistence: Implement persistence mechanisms to save user progress and task completions.
Last updated