-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.py
More file actions
31 lines (28 loc) · 1.06 KB
/
utils.py
File metadata and controls
31 lines (28 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
def parse_time(time_str):
"""Convert time in 'mm:ss' format or seconds to total seconds."""
if ":" in time_str:
minutes, seconds = map(int, time_str.split(":"))
return minutes * 60 + seconds
return int(time_str)
def mention_players(target_groups, usernames):
"""Generate mentions for target player groups."""
# Map player positions to usernames
position_map = {
"safe": [usernames[0], usernames[4]],
"mid": [usernames[1]],
"off": [usernames[2], usernames[3]],
"supps": [usernames[3], usernames[4]],
"cores": [usernames[0], usernames[1], usernames[2]],
"all": usernames,
"1": [usernames[0]],
"2": [usernames[1]],
"3": [usernames[2]],
"4": [usernames[3]],
"5": [usernames[4]]
}
# Collect unique mentions from each target group
mentioned_users = set()
for group in target_groups:
mentioned_users.update(position_map.get(group, []))
mentions = [f"@{user}" for user in mentioned_users]
return " ".join(mentions) if mentions else ""