Task Handlers

class bot.handlers.task.TaskCreationStates(*args, **kwargs)[source]

Bases: StatesGroup

States for task creation flow.

Parameters:
  • args (Any)

  • kwargs (Any)

Return type:

Any

async bot.handlers.task.cancel_task_creation(callback, state)

Cancel task creation process.

Return type:

None

Parameters:
  • callback (aiogram.types.CallbackQuery)

  • state (aiogram.fsm.context.FSMContext)

async bot.handlers.task.command_create_task(message, state)

Create a new autonomous search task: /task <description> or /task to start interactive mode.

Return type:

None

Parameters:
  • message (aiogram.types.Message)

  • state (aiogram.fsm.context.FSMContext)

async bot.handlers.task.command_history_handler(message)

Show task history with selection and pagination.

Return type:

None

Parameters:

message (aiogram.types.Message)

async bot.handlers.task.command_status_handler(message)

Show current task status with enhanced information.

Return type:

None

Parameters:

message (aiogram.types.Message)

async bot.handlers.task.create_task_for_user(user, description, message)[source]

Create task for user with full validation and queue management.

Parameters:
  • user – User instance

  • description (str) – Task description

  • message (Message) – Telegram message

Return type:

None

bot.handlers.task.format_time_estimate(seconds)[source]

Format time estimate in human readable format.

Parameters:

seconds (float) – Time in seconds

Return type:

str

Returns:

Formatted time string

bot.handlers.task.get_plan_display_name(plan)[source]

Get display name for user plan.

Parameters:

plan (UserPlan) – User plan enum

Return type:

str

Returns:

Display name

bot.handlers.task.get_status_emoji(status)[source]

Get emoji for task status.

Parameters:

status – Task status (enum or string)

Return type:

str

Returns:

Emoji string

async bot.handlers.task.history_back_to_list(callback)

Go back to task history list.

Return type:

None

Parameters:

callback (aiogram.types.CallbackQuery)

async bot.handlers.task.process_task_description(message, state)

Process task description in interactive mode.

Return type:

None

Parameters:
  • message (aiogram.types.Message)

  • state (aiogram.fsm.context.FSMContext)

async bot.handlers.task.rate_limit_check(message, action_type)[source]

Check rate limits for user action and send error message if exceeded.

Parameters:
  • message (Message) – Telegram message

  • action_type (str) – Type of action being performed

Return type:

bool

Returns:

True if allowed, False if rate limited

async bot.handlers.task.show_recent_analyses_all(callback)

Show recent analyses from all user tasks.

Return type:

None

Parameters:

callback (aiogram.types.CallbackQuery)

async bot.handlers.task.show_task_history(callback)

Show detailed history for a specific task.

Return type:

None

Parameters:

callback (aiogram.types.CallbackQuery)

async bot.handlers.task.start_interactive_task_creation(user, message, state)[source]

Start interactive task creation flow.

Parameters:
  • user – User instance

  • message (Message) – Telegram message

  • state (FSMContext) – FSM context

Return type:

None