feat: add /hive command to create Hive tasks from Telegram - #5
Open
mainshivam wants to merge 2 commits into
Open
feat: add /hive command to create Hive tasks from Telegram#5mainshivam wants to merge 2 commits into
mainshivam wants to merge 2 commits into
Conversation
mainshivam
force-pushed
the
feat/hive-task-command
branch
from
July 29, 2026 15:54
edee350 to
71587d1
Compare
Adds a conversation handler that walks the user through creating a Hive
Task: title, optional description, start date, end date, project picker
and a multi-select assignee picker.
The flow has no Frappe HR dependency, so it works on sites that run Hive
without HR or ERPNext. Supporting changes for that:
- BotConversation gains `requires_employee` (default True, so leave and
WFH are unchanged) and `required_doctypes`. Commands are registered
process-wide, so a site missing the owning app now gets a readable
message instead of a traceback.
- install.py skips custom fields whose doctype is absent. Previously the
whole install failed on a site without HR because it created a field
on Attendance Request. after_migrate re-runs it, so the field still
appears if HR is installed later.
- The daily leave/WFH broadcasts and the monthly petty cash job return
early when their doctypes are missing, instead of raising on schedule.
Assignees are written to the standard `_assign` field, matching how Hive
tracks them.
Also fixes the command descriptions shown in the Telegram menu. Every
conversation registers the same bound BotConversation.handle_command, so
storing the description on the function object meant each registration
overwrote the previous one and all commands ended up showing the last
one ("Apply for Work From Home"). Descriptions now live in a dict keyed
by command.
Adds bwh_bot/tests/test_hive.py: 15 tests covering the flow, validation,
navigation, the dependency gate and the description regression.
CI runs pre-commit with --all-files, and the committed tree did not satisfy the repo's own ruff config, so every pull request failed the linter before reaching its own changes. The linter job only runs on pull_request, which is why this drift was never caught on develop. Formatting only, plus RUF005 (use iterable unpacking instead of list concatenation) in confirm_buttons and the two _summary_buttons helpers. No behaviour changes.
mainshivam
force-pushed
the
feat/hive-task-command
branch
from
July 29, 2026 15:58
71587d1 to
4b203f5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why?
The bot could only do HR flows (leave, WFH, petty cash), all of which need Frappe HR. Teams running Hive without HR or ERPNext had nothing they could use, and the app could not even be installed on such a site.
What?
A
/hivecommand that creates a Hive Task from Telegram, with no HR dependency.The flow: task title -> optional description -> start date -> end date -> project picker -> assignee picker (multi-select, tap to toggle) -> review -> create.
Projects come from open, non-archived
Hive Projectrecords. Assignees come from activeHive Memberrecords of type Team, and are written to the standard_assignfield, matching how Hive tracks them.How?
Making this work without HR needed three supporting changes:
BotConversationgainsrequires_employee(defaultTrue, so leave and WFH behave exactly as before) andrequired_doctypes. Commands are registered process-wide, so a site missing the owning app now gets a readable message instead of a traceback part way through a conversation.install.pyskips custom fields whose doctype is absent. Previously a site without HR failed to install the app at all, becauseafter_installcreated a field onAttendance Request.after_migratere-runs it, so the field still appears if HR is installed later.Also fixed
Every command in the Telegram menu showed the same description, "Apply for Work From Home".
Each conversation registers the same bound
BotConversation.handle_command, sofn.__func__._description = descriptionwrote to one shared function object and the last registration won for all of them./pingwas unaffected because it is a plain function. Descriptions now live in a dict keyed by command.Tests
Adds
bwh_bot/tests/test_hive.py, 15 tests, the first in this app:_assignRun with:
Verified on
A site with Hive but no HR and no ERPNext (frappe, raven, bwh_hive, drive, bwh_bot), plus a site with HR installed to confirm leave and WFH are unchanged.