Răsfoiți Sursa

darkirc: [taubot] properly notify about addition or removal of multiple assignees

dasman 1 an în urmă
părinte
comite
715a611278
1 a modificat fișierele cu 15 adăugiri și 1 ștergeri
  1. 15 1
      bin/darkirc/script/bots/taubot.py

+ 15 - 1
bin/darkirc/script/bots/taubot.py

@@ -100,7 +100,21 @@ while True:
                     project = task['project'] if task['project'] is not None else []
                     if args.skip in project or '+' + args.skip in task['tags'] or args.skip_workspace in task['workspace']:
                         channel = args.alt_chan
+                    
+                    removed = []
+                    added = []
+                    for assignee in assignees.split(', '):
+                        if assignee.startswith("-"):
+                            removed.append(assignee[1:])
+                        else:
+                            added.append(assignee)
+
+                    if removed and added:
+                        notification = f"{user} added {', '.join(added)} and removed {', '.join(removed)} from assign in task ({refid}): {title}"
+                    if (not removed) and added:
+                        notification = f"{user} added {', '.join(added)} to assign in task ({refid}): {title}"
+                    if (not added) and removed:
+                        notification = f"{user} removed {', '.join(removed)} from assign in task ({refid}): {title}"
 
-                    notification = f"{user} reassigned task ({refid}): {title} to {assignees}"
                     # print(notification)
                     ircc.send(channel, notification)