|  |  | @ -48,10 +48,15 @@ export async function handleTaskCommand(body: string, sender: string, groupId: s | 
			
		
	
		
		
			
				
					
					|  |  |  |       const dueDateMatch = description.match(/\d{4}-\d{2}-\d{2}/); |  |  |  |       const dueDateMatch = description.match(/\d{4}-\d{2}-\d{2}/); | 
			
		
	
		
		
			
				
					
					|  |  |  |       const dueDate = dueDateMatch ? dueDateMatch[0] : null; |  |  |  |       const dueDate = dueDateMatch ? dueDateMatch[0] : null; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |       const cleanDescription = description |  |  |  |       // Extract and clean description - remove mentions and dates
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         .replace(/@\w+/g, '') |  |  |  |       let cleanDescription = description; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         .replace(/\d{4}-\d{2}-\d{2}/g, '') |  |  |  |       if (assignedUserMatch) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         .trim(); |  |  |  |         cleanDescription = cleanDescription.replace(assignedUserMatch[0], '').trim(); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       if (dueDateMatch) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         cleanDescription = cleanDescription.replace(dueDateMatch[0], '').trim(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       cleanDescription = cleanDescription.trim(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |       if (!action || action === 'mostrar') { |  |  |  |       if (!action || action === 'mostrar') { | 
			
		
	
		
		
			
				
					
					|  |  |  |         // Handle bare /tarea or /tarea mostrar
 |  |  |  |         // Handle bare /tarea or /tarea mostrar
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -73,16 +78,23 @@ export async function handleTaskCommand(body: string, sender: string, groupId: s | 
			
		
	
		
		
			
				
					
					|  |  |  |             dueDate: dueDate || undefined |  |  |  |             dueDate: dueDate || undefined | 
			
		
	
		
		
			
				
					
					|  |  |  |           }); |  |  |  |           }); | 
			
		
	
		
		
			
				
					
					|  |  |  |            |  |  |  |            | 
			
		
	
		
		
			
				
					
					|  |  |  |           let message = `✅ Tarea creada:\nID: ${task.id}\nDescripción: ${task.description}`; |  |  |  |           // Format the message with proper text property
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |           if (task.assignedTo) message += `\nAsignada a: ${task.assignedTo}`; |  |  |  |           const message = { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |           if (task.dueDate) message += `\nFecha límite: ${task.dueDate}`; |  |  |  |             text: `✅ Tarea creada:\nID: ${task.id}\nDescripción: ${task.description}` +  | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |           message += `\nCreada: ${task.createdAt}`; |  |  |  |                   (task.assignedTo ? `\nAsignada a: ${formatUserMention(task.assignedTo)}` : '') + | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                   (task.dueDate ? `\nFecha límite: ${task.dueDate}` : '') + | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                   `\nCreada: ${task.createdAt}` | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           }; | 
			
		
	
		
		
			
				
					
					|  |  |  |            |  |  |  |            | 
			
		
	
		
		
			
				
					
					|  |  |  |           // Send confirmation privately to creator
 |  |  |  |           // Send confirmation privately to creator
 | 
			
		
	
		
		
			
				
					
					|  |  |  |           sendMessage(sender, message); |  |  |  |           sendMessage(sender, message.text); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |           // Also notify assignee if different from creator
 |  |  |  |           // Also notify assignee if different from creator
 | 
			
		
	
		
		
			
				
					
					|  |  |  |           if (assignedUser && assignedUser !== `@${sender.split('@')[0]}`) { |  |  |  |           if (assignedUser && assignedUser !== `@${sender.split('@')[0]}`) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             sendMessage(assignedUser, `📝 Se te ha asignado una nueva tarea:\n${message}`, [assignedUser.split('@')[0]]); |  |  |  |             const assigneeMessage = { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |               text: `📝 Se te ha asignado una nueva tarea:\n${message.text}`, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |               mentions: [assignedUser] | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             }; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             sendMessage(assignedUser, assigneeMessage.text, assigneeMessage.mentions); | 
			
		
	
		
		
			
				
					
					|  |  |  |           } |  |  |  |           } | 
			
		
	
		
		
			
				
					
					|  |  |  |         } catch (error) { |  |  |  |         } catch (error) { | 
			
		
	
		
		
			
				
					
					|  |  |  |           console.error('Error creating task:', error); |  |  |  |           console.error('Error creating task:', error); | 
			
		
	
	
		
		
			
				
					|  |  | 
 |