diff --git a/main.py b/main.py index dc2cb8c..8796d22 100644 --- a/main.py +++ b/main.py @@ -352,10 +352,26 @@ class LabCleaningBot: accept_result = request.try_accept(now=reactionTimestamp) match accept_result: - case Ok(AcceptInTime()): - response_msg = "You accepted the request." - case Ok(AcceptAfterRejectAllowed()): - response_msg = "You accepted the request after rejecting it." + case Ok(AcceptInTime()) | Ok(AcceptAfterRejectAllowed()): + response_msg = """Thank you! You accepted the request. + +I will add you to a signal group dedicated for this task. You can not directly leave the signal group until the task has started. + +If due to any reason you can not participate, please just change your "👍" reaction above to something else or remove the reaction. I will let the others know that you can not participate, remove you from the group and ask another person to overtake your task.""" + + self.api.add_group_members(request.task.chatgroup, [source]) + + number_of_additional_requests_to_be_sent = request.task.additional_requests_to_be_sent() + + if number_of_additional_requests_to_be_sent < 0: + self.api.send_message(SendMessageSimple( + message="This task now has more participants than necessary. This can happen if a person has first rejected a request and then accepted it. You can handle this situation as you like.", + recipients=[request.task.chatgroup])) + elif number_of_additional_requests_to_be_sent < 1: + self.api.send_message(SendMessageSimple( + message="Enough participants have accepted the task. You can now start coordinating your task.", + recipients=[request.task.chatgroup])) + case Err(AcceptAfterRejectExpired()): response_msg = "You cannot accept the request after rejecting it after 5 minutes." case Err(AlreadyAccepted()): @@ -367,9 +383,14 @@ class LabCleaningBot: match reject_result: case Ok(RejectInTime()): - response_msg = "You rejected the request." + response_msg = "You rejected the request. I will ask another person to overtake the task." case Ok(RejectAfterAccept()): - response_msg = "You rejected the request after accepting it." + response_msg = "You rejected the request after accepting it. I will remove you from the group now and ask another person to overtake the task." + + self.api.send_message(SendMessageSimple( + message="Person will be removed now, since they rejected the request after initially accepting the task. This is most likely because the person does not have time anymore, something unexpected came up for the person or something else. I will ask another person to overtake the task. If this is not possible, I will let you know in a separate message below.", + recipients=[request.task.chatgroup])) + case Err(AlreadyRejected()): response_msg = "You already rejected the request." case Err(RejectAfterTimeout()):