How cue2g/ciwok_bot works
ciwokBot is a Telegram bot for registering task work against groups and service types. Users register a group and unit value, start a task flow, select a service, and submit an assignee and quantity; the bot calculates a value and sends the task to an external endpoint. A direct /tarea command also submits task details. MongoDB-backed group, user, and active-session state supports these flows. The excerpts show command wiring, persistence calls, and submission; other runtime details are included only where documented or visible in the sampled files.
Main entry points: cmds.ts Command registry · botController.ts Task calculation · start.ts Start task flow · groupsControllers.ts Group service
Components 17
Bot runtime
- Bot and health host
app.ts - Command registry
src/cmds.ts
Task flows
- Register group
src/cmds/addGroup.ts - Start task flow
src/cmds/start.ts - Choose service
src/cmds/services.ts - Direct task
src/cmds/tarea.ts
Domain services
- Task calculation
src/controllers/botController.ts - Group service
src/controllers/groupsControllers.ts - User service
src/controllers/usersController.ts - Active session service
src/controllers/activeUsersController.ts
Persistence
- Groups
src/models/Groups.ts - Users
src/models/Users.ts - Active users
src/models/ActiveUsers.ts
Other components
- Telegram user
- Telegram
- Task API
- MongoDB
Connections 25
- Telegram user → Telegram: sends commands
README.md - Bot and health host → Command registry: registers commands
app.ts - Command registry → Start task flow: routes /start
src/cmds.ts - Command registry → Register group: routes command
src/cmds.ts - Command registry → Choose service: routes action
src/cmds.ts - Command registry → Direct task: routes command
src/cmds.ts - Telegram → Command registry: delivers updates
- Register group → Group service: checks and creates
src/cmds/addGroup.ts - Start task flow → Group service: checks group
src/cmds/start.ts - Start task flow → Active session service: registers session
src/cmds/start.ts - Start task flow → User service: checks and creates
src/cmds/start.ts - Start task flow → Telegram: sends service menu
src/cmds/start.ts - Choose service → Active session service: updates and reads
src/cmds/services.ts - Choose service → Task calculation: saves task
src/cmds/services.ts - Direct task → Group service: checks group
src/cmds/tarea.ts - Direct task → Task calculation: submits task
src/cmds/tarea.ts - Task calculation → Group service: gets group value
src/controllers/botController.ts - Task calculation → User service: gets author
src/controllers/botController.ts - Task calculation → Task API: posts task
src/controllers/botController.ts - Task calculation → Telegram: announces task
src/controllers/botController.ts - Group service → Groups: queries and writes
src/controllers/groupsControllers.ts - User service → Users: queries and writes
src/controllers/usersController.ts - Active session service → Active users: queries and writes
src/controllers/activeUsersController.ts - Bot and health host → MongoDB: connects
app.ts - Bot and health host → Telegram: launches bot
app.ts