forked from LeineLab-Public/lab-signal-bot
LabCleaningBot: better messages
This commit is contained in:
parent
dee545a6fa
commit
22911eae50
33
main.py
33
main.py
@ -352,10 +352,26 @@ class LabCleaningBot:
|
|||||||
accept_result = request.try_accept(now=reactionTimestamp)
|
accept_result = request.try_accept(now=reactionTimestamp)
|
||||||
|
|
||||||
match accept_result:
|
match accept_result:
|
||||||
case Ok(AcceptInTime()):
|
case Ok(AcceptInTime()) | Ok(AcceptAfterRejectAllowed()):
|
||||||
response_msg = "You accepted the request."
|
response_msg = """Thank you! You accepted the request.
|
||||||
case Ok(AcceptAfterRejectAllowed()):
|
|
||||||
response_msg = "You accepted the request after rejecting it."
|
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()):
|
case Err(AcceptAfterRejectExpired()):
|
||||||
response_msg = "You cannot accept the request after rejecting it after 5 minutes."
|
response_msg = "You cannot accept the request after rejecting it after 5 minutes."
|
||||||
case Err(AlreadyAccepted()):
|
case Err(AlreadyAccepted()):
|
||||||
@ -367,9 +383,14 @@ class LabCleaningBot:
|
|||||||
|
|
||||||
match reject_result:
|
match reject_result:
|
||||||
case Ok(RejectInTime()):
|
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()):
|
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()):
|
case Err(AlreadyRejected()):
|
||||||
response_msg = "You already rejected the request."
|
response_msg = "You already rejected the request."
|
||||||
case Err(RejectAfterTimeout()):
|
case Err(RejectAfterTimeout()):
|
||||||
|
Loading…
Reference in New Issue
Block a user