Beispiel #1
0
def footy_live_fixtures(room: str, username: str, subs=False) -> str:
    """
    Fetch live fixtures for EPL, LIGA, BUND, FA, UCL, EUROPA, etc.

    :param str room: Chatango room in which command was triggered.
    :param str username: Name of user who triggered the command.
    :param bool subs: Whether to include substitutions in match summaries.

    :returns: str
    """
    live_fixtures = "\n\n\n\n"
    i = 0
    for league_name, league_id in FOOTY_LEAGUES.items():
        live_league_fixtures = footy_live_fixtures_per_league(league_id,
                                                              league_name,
                                                              room,
                                                              username,
                                                              subs=subs)
        if live_league_fixtures is not None and i < 6:
            i += 1
            live_fixtures += live_league_fixtures + "\n"
    if live_fixtures == "\n\n\n\n":
        return emojize(":warning: No live fixtures :( :warning:",
                       use_aliases=True)
    return live_fixtures
Beispiel #2
0
def footy_all_upcoming_fixtures(room: str, username: str) -> str:
    """
    Fetch upcoming fixtures within 1 week for ALL leagues.

    :param str room: Chatango room in which command was triggered.
    :param str username: Name of user who triggered the command.

    :returns: str
    """
    upcoming_fixtures = "\n\n\n\n"
    for league_name, league_id in FOOTY_LEAGUES.items():
        league_fixtures = footy_upcoming_fixtures_per_league(league_name, league_id, room, username)
        if league_fixtures is not None:
            upcoming_fixtures += emojize(f"<b>{league_name}:</b>\n", use_aliases=True)
            upcoming_fixtures += league_fixtures + "\n"
    if upcoming_fixtures != "\n\n\n\n":
        return upcoming_fixtures
    return emojize(":warning: Couldn't find any upcoming fixtures :( :warning:", use_aliases=True)
Beispiel #3
0
def today_upcoming_fixtures(room: str, username: str) -> str:
    """
    Fetch fixtures scheduled to occur today.

    :param str room: Chatango room in which command was triggered.
    :param str username: Name of user who triggered the command.

    :returns: str
    """
    upcoming_fixtures = "\n\n\n\n"
    i = 0
    for league_name, league_id in FOOTY_LEAGUES.items():
        league_fixtures = today_upcoming_fixtures_per_league(
            league_name, league_id, room, username)
        if league_fixtures is not None and i < 5:
            i += 1
            upcoming_fixtures += league_fixtures + "\n"
    if upcoming_fixtures != "\n\n\n\n":
        return upcoming_fixtures
    return emojize(
        f":soccer_ball: :cross_mark: sry @{username} no fixtures today :( :cross_mark: :soccer_ball:",
        use_aliases=True,
    )