File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -453,15 +453,24 @@ def marvinNameday(row):
453453 r = requests .get (url , timeout = 5 )
454454 nameday_data = r .json ()
455455 names = nameday_data ["dagar" ][0 ]["namnsdag" ]
456+ parsed_names = formatNames (names )
456457 if names :
457- msg = getString ("nameday" , "somebody" ).format ("," . join ( names ) )
458+ msg = getString ("nameday" , "somebody" ).format (parsed_names )
458459 else :
459460 msg = getString ("nameday" , "nobody" )
460461 except Exception as e :
461462 LOG .error ("Failed to get nameday: %s" , e )
462463 msg = getString ("nameday" , "error" )
463464 return msg
464465
466+ def formatNames (names ):
467+ """
468+ Parses namedata from nameday API
469+ """
470+ if len (names ) > 1 :
471+ return " och " .join ([", " .join (names [:- 1 ])] + names [- 1 :])
472+ return "" .join (names )
473+
465474def marvinUptime (row ):
466475 """
467476 Display info about uptime tournament
You can’t perform that action at this time.
0 commit comments