fix: season 4 changes

This commit is contained in:
insert 2025-07-28 17:12:24 -04:00
parent 9d8ad73c51
commit f4a12a1da0
Signed by: insert
GPG key ID: A70775C389ACF105
2 changed files with 18 additions and 15 deletions

View file

@ -302,9 +302,9 @@ async def feedsubscriptionworker(self,serverid,channelid,teamid,offset):
channel = self.bot.get_channel(channelid)
if channel is None:
return
data = await session.get(f"https://mmolb.com/api/team/{teamid}")
data = await session.get(f"https://mmolb.com/api/feed?team={teamid}")
data = await data.json()
data = data['Feed']
data = data['feed']
if len(data) > offset:
finalstr = ""
for index in itertools.islice(data, offset, len(data)):
@ -531,7 +531,7 @@ class liveupdate(commands.Cog):
await interaction.response.defer()
teamid = self.bot.teams_dict[team]
async with aiohttp.ClientSession() as session:
data = await session.get(f"https://mmolb.com/api/team/{teamid}")
data = await session.get(f"https://mmolb.com/api/feed?team={teamid}")
data = await data.json()
offset = len(data['Feed'])
await self.bot.db.execute(f"""

View file

@ -217,7 +217,7 @@ class TeamView(nextcord.ui.View):
embed = ogmsg[0]
teamid = embed.footer.text
data = requests.get(f"https://mmolb.com/api/team/{teamid}").json()
history = requests.get(f"https://freecashe.ws/api/games?team={teamid}&season=3").json()["items"]
history = requests.get(f"https://freecashe.ws/api/games?team={teamid}&season=4").json()["items"]
color = tuple(int(data["Color"][i:i+2], 16) for i in (0, 2, 4))
embed = nextcord.Embed(title=f"Last ten games for the {data["Location"]} {data["Name"]} {data["Emoji"]}", colour = nextcord.Color.from_rgb(color[0], color[1], color[2]))
embed.set_footer(text=teamid)
@ -243,12 +243,14 @@ class TeamView(nextcord.ui.View):
embed = ogmsg[0]
teamid = embed.footer.text
async with aiohttp.ClientSession() as session:
data = await session.get(f"https://mmolb.com/api/team/{teamid}")
basedata = await session.get(f"https://mmolb.com/api/team/{teamid}")
basedata = await basedata.json()
data = await session.get(f"https://mmolb.com/api/feed?team={teamid}")
data = await data.json()
color = tuple(int(data["Color"][i:i+2], 16) for i in (0, 2, 4))
embed = nextcord.Embed(title=f"Last ten feed events for the {data["Location"]} {data["Name"]} {data["Emoji"]}", colour = nextcord.Color.from_rgb(color[0], color[1], color[2]))
color = tuple(int(basedata["Color"][i:i+2], 16) for i in (0, 2, 4))
embed = nextcord.Embed(title=f"Last ten feed events for the {basedata["Location"]} {basedata["Name"]} {basedata["Emoji"]}", colour = nextcord.Color.from_rgb(color[0], color[1], color[2]))
embed.set_footer(text=teamid)
data = data['Feed']
data = data['feed']
for index in itertools.islice(data, (len(data)-10 if len(data)-10 > 0 else 0) , len(data)):
embed.add_field(name=f"{index['emoji']} Day {index['day']} Season {index['season']}", value=index['text'], inline=False)
await interaction.followup.send(embed=embed,ephemeral=True)
@ -294,14 +296,13 @@ class team(commands.Cog):
if i["_id"] == teamid:
break
color = tuple(int(data["Color"][i:i+2], 16) for i in (0, 2, 4))
embed = nextcord.Embed(title=f"{data["Location"]} {data["Name"]} {data["Emoji"]}",description=f"{"Inactive" if not data['Active'] else "Active"}", colour = nextcord.Color.from_rgb(color[0], color[1], color[2]))
embed = nextcord.Embed(title=f"{data["Location"]} {data["Name"]} {data["Emoji"]}", colour = nextcord.Color.from_rgb(color[0], color[1], color[2]))
embed.add_field(name="League", value=f"{dict((v,k) for k,v in self.bot.leagues_dict.items())[data["League"]]}", inline=True)
embed.add_field(name="Ballpark", value=data['BallparkName'])
embed.add_field(name="Wins", value=f"{data["Record"]["Regular Season"]["Wins"]}", inline=True)
embed.add_field(name="Losses", value=f"{data["Record"]["Regular Season"]["Losses"]}", inline=True)
embed.add_field(name="Run Differential", value=f"{data["Record"]["Regular Season"]["RunDifferential"]}", inline=True)
embed.add_field(name="Rank", value=f"{ranking}", inline=True)
embed.add_field(name="Augments", value=f"{data["Augments"]}", inline=True)
embed.add_field(name="Championships", value=f"{data["Championships"]}", inline=True)
embed.set_footer(text=teamid)
await interaction.edit_original_message(embed=embed,view=TeamView())
@ -340,7 +341,7 @@ class team(commands.Cog):
await interaction.response.defer()
teamid = teams_dict[team]
data = requests.get(f"https://mmolb.com/api/team/{teamid}").json()
history = requests.get(f"https://freecashe.ws/api/games?team={teamid}&season=3").json()["items"]
history = requests.get(f"https://freecashe.ws/api/games?team={teamid}&season=4").json()["items"]
color = tuple(int(data["Color"][i:i+2], 16) for i in (0, 2, 4))
embed = nextcord.Embed(title=f"Last ten games for the {data["Location"]} {data["Name"]} {data["Emoji"]}", colour = nextcord.Color.from_rgb(color[0], color[1], color[2]))
embed.set_footer(text=teamid)
@ -429,12 +430,14 @@ class team(commands.Cog):
await interaction.response.defer()
teamid = teams_dict[team]
async with aiohttp.ClientSession() as session:
data = await session.get(f"https://mmolb.com/api/team/{teamid}")
basedata = await session.get(f"https://mmolb.com/api/team/{teamid}")
basedata = await basedata.json()
data = await session.get(f"https://mmolb.com/api/feed?team={teamid}")
data = await data.json()
color = tuple(int(data["Color"][i:i+2], 16) for i in (0, 2, 4))
embed = nextcord.Embed(title=f"Last ten feed events for the {data["Location"]} {data["Name"]} {data["Emoji"]}", colour = nextcord.Color.from_rgb(color[0], color[1], color[2]))
color = tuple(int(basedata["Color"][i:i+2], 16) for i in (0, 2, 4))
embed = nextcord.Embed(title=f"Last ten feed events for the {basedata["Location"]} {basedata["Name"]} {basedata["Emoji"]}", colour = nextcord.Color.from_rgb(color[0], color[1], color[2]))
embed.set_footer(text=teamid)
data = data['Feed']
data = data['feed']
for index in itertools.islice(data, (len(data)-10 if len(data)-10 > 0 else 0) , len(data)):
embed.add_field(name=f"{index['emoji']} Day {index['day']} Season {index['season']}", value=index['text'], inline=False)
await interaction.edit_original_message(embed=embed)