Bots.Business - Help
  • Welcome
  • Getting started
  • Create bot from Google Table
  • App
    • Reset or Update Your Password
  • Commands
    • Answer
    • Aliases
    • Keyboard
    • Groups
    • Wait for answer
    • Auto Retry (AR)
  • Coding: BJS
    • Variables
    • Bot functions
    • Message broadcasting and editing
    • User functions
    • Properties
    • Always running commands
    • Error command: "!"
    • Lists
      • Migration from properties to list
    • Api functions
    • BB Admin functions
    • Admin Panel
    • Send HTTP request
    • Web App
    • Caching
    • Inline Bot
    • BJS Security
    • Good coding practices
    • Top errors
  • Git
    • Import bot from Git repository
    • Export bot to Git repository
    • Repository structure
    • File: bot.json
    • Automatic importing on Git push
  • Iterations. How to reduce theys?
  • Limitations
  • Cloud
  • Reports
  • Deep Linking - pass any params on Bot starting
  • How to link chat account with BB account?
  • BB Inspection
  • Protected bot
  • VS Code
  • How to...
  • Smart Bot
    • Overview
    • Lang File
    • SmartBot
    • SmartTasker
    • Amount Dialog
  • Libs
    • What it is - Libs?
    • Libs development
    • RefferalLib
    • ResourcesLib
    • Random
    • MembershipChecker (MCL)
    • Cooldown Lib
    • CurrencyConverter
    • Lang
    • TopBoardLib
    • QiwiPayments
    • Coinbase (CB)
    • CoinPayments (CP)
    • OxaPay
    • CryptoJS
    • CurrencyQuote
    • GoogleApp
    • GoogleTableSync
    • Guard
    • Webhooks lib
    • DateTimeFormat Lib
  • Store
    • BB Point Bot
    • Welcome bot
    • Help bot
    • SRB Demo Keyboard Tools
Powered by GitBook
On this page
  • Introduction
  • Key Features
  • Constructor
  • Core Methods
  • getTasksForWork
  • skipTask
  • defineTask
  • completeExecution
  • addBalance
  • prepareTaskQuestion
  • acceptAnswer
  • Best Practices

Was this helpful?

  1. Smart Bot

SmartTasker

PreviousSmartBotNextAmount Dialog

Last updated 1 year ago

Was this helpful?

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: - 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:

constructor(options);

Parameters:

  • options: An object containing initial settings such as task list, balance, and a reference to SmartBot.

Example:

let tasker = new SmartTasker({
  tasks: [...],
  balance: 100,
  smartBot: botInstance
});

Core Methods

getTasksForWork

Fetches tasks available for the user to work on.

Usage:

let availableTasks = tasker.getTasksForWork();

skipTask

Skips the current task and moves to the next one.

Usage:

let hasNext = tasker.skipTask();

defineTask

Defines the current task based on the task ID or task definition.

Usage:

tasker.defineTask(taskIdOrDefinition);

completeExecution

Marks the current task as completed and processes the reward.

Usage:

tasker.completeExecution(taskId);

addBalance

Adds a specified amount to the user's balance.

Usage:

tasker.addBalance(amount);

prepareTaskQuestion

Prepares a question related to a task for user interaction.

Usage:

tasker.prepareTaskQuestion({ taskID: 'task1', onAnswer: 'handleAnswer' });

acceptAnswer

Processes the user's answer to a task question.

Usage:

let result = tasker.acceptAnswer(params);

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.

BBDemoTaskBot