mirror of
https://github.com/insertapp/mmolbbot.git
synced 2025-08-02 03:03:34 +00:00
core: season 3 updates
This commit is contained in:
parent
c77964c255
commit
9e52347be3
2 changed files with 12 additions and 7 deletions
|
@ -68,9 +68,9 @@ async def livegameworker(self,serverid,userid,channelid,messageid,gameid,offset)
|
||||||
embed.add_field(name="Outs",value="🔴🔴")
|
embed.add_field(name="Outs",value="🔴🔴")
|
||||||
case _:
|
case _:
|
||||||
embed.add_field(name="Outs",value="⭕⭕")
|
embed.add_field(name="Outs",value="⭕⭕")
|
||||||
embed.add_field(name="Batting",value=data["entries"][-1]["batter"], inline=True)
|
embed.add_field(name="Batting",value=f"{data["entries"][-1]["batter"]}.", inline=True)
|
||||||
embed.add_field(name="Pitching",value=data["entries"][-1]["pitcher"], inline=True)
|
embed.add_field(name="Pitching",value=f"{data["entries"][-1]["pitcher"]}.", inline=True)
|
||||||
embed.add_field(name="On Deck",value=data["entries"][-1]["on_deck"], inline=True)
|
embed.add_field(name="On Deck",value=f"{data["entries"][-1]["on_deck"]}.", inline=True)
|
||||||
embed.add_field(name=f"Last 7 events",value=finalstr[-1024:],inline=False)
|
embed.add_field(name=f"Last 7 events",value=finalstr[-1024:],inline=False)
|
||||||
embed.set_thumbnail(f"https://insertapp.net/mmolbbot/assets/diamond_{data["entries"][-1]["on_1b"]}_{data["entries"][-1]["on_2b"]}_{data["entries"][-1]["on_3b"]}.png")
|
embed.set_thumbnail(f"https://insertapp.net/mmolbbot/assets/diamond_{data["entries"][-1]["on_1b"]}_{data["entries"][-1]["on_2b"]}_{data["entries"][-1]["on_3b"]}.png")
|
||||||
embed.set_footer(text=f"Embed too big? Need historical data? consider classic mode.")
|
embed.set_footer(text=f"Embed too big? Need historical data? consider classic mode.")
|
||||||
|
@ -537,9 +537,14 @@ class liveupdate(commands.Cog):
|
||||||
try:
|
try:
|
||||||
await self.bot.wait_until_ready()
|
await self.bot.wait_until_ready()
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession() as session:
|
||||||
game = await session.get("https://mmolb.com/api/spotlight")
|
try:
|
||||||
game = await game.json()
|
game = await session.get("https://mmolb.com/api/spotlight")
|
||||||
gameid = game["game_id"]
|
game = await game.json()
|
||||||
|
gameid = game["game_id"]
|
||||||
|
except KeyError:
|
||||||
|
game = await session.get("https://mmolb.com/api/event-games")
|
||||||
|
game = await game.json()
|
||||||
|
gameid = game["games"][-1]["game_id"]
|
||||||
data = await session.get(f"https://mmolb.com/api/game/{gameid}")
|
data = await session.get(f"https://mmolb.com/api/game/{gameid}")
|
||||||
data = await data.json()
|
data = await data.json()
|
||||||
res = await self.bot.db.execute("SELECT serverid,channelid,classic FROM spotlightsubscriptions")
|
res = await self.bot.db.execute("SELECT serverid,channelid,classic FROM spotlightsubscriptions")
|
||||||
|
|
|
@ -216,7 +216,7 @@ class TeamView(nextcord.ui.View):
|
||||||
embed = ogmsg[0]
|
embed = ogmsg[0]
|
||||||
teamid = embed.footer.text
|
teamid = embed.footer.text
|
||||||
data = requests.get(f"https://mmolb.com/api/team/{teamid}").json()
|
data = requests.get(f"https://mmolb.com/api/team/{teamid}").json()
|
||||||
history = requests.get(f"https://freecashe.ws/api/games?team={teamid}&season=2").json()["items"]
|
history = requests.get(f"https://freecashe.ws/api/games?team={teamid}&season=3").json()["items"]
|
||||||
color = tuple(int(data["Color"][i:i+2], 16) for i in (0, 2, 4))
|
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 = 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)
|
embed.set_footer(text=teamid)
|
||||||
|
|
Loading…
Reference in a new issue