Library updated, use the new functioning async api calls
This commit is contained in:
parent
ec6fa7331b
commit
2ea7819b8b
@ -8,7 +8,7 @@
|
||||
"install_msg": "Thank you for installing LaunchLib. Get started with `[p]load launchlib`, then `[p]help LaunchLib`",
|
||||
"short": "Access launch data for space flights",
|
||||
"end_user_data_statement": "This cog does not store any End User Data",
|
||||
"requirements": ["python-launch-library"],
|
||||
"requirements": ["python-launch-library>=1.0.6"],
|
||||
"tags": [
|
||||
"bobloy",
|
||||
"utils",
|
||||
|
@ -34,10 +34,10 @@ class LaunchLib(commands.Cog):
|
||||
"""Nothing to delete"""
|
||||
return
|
||||
|
||||
async def _embed_launch_data(self, launch: ll.Launch):
|
||||
status: ll.LaunchStatus = launch.get_status()
|
||||
async def _embed_launch_data(self, launch: ll.AsyncLaunch):
|
||||
status: ll.AsyncLaunchStatus = await launch.get_status()
|
||||
|
||||
rocket: ll.Rocket = launch.rocket
|
||||
rocket: ll.AsyncRocket = launch.rocket
|
||||
|
||||
title = launch.name
|
||||
description = status.description
|
||||
@ -105,15 +105,13 @@ class LaunchLib(commands.Cog):
|
||||
@launchlib.command()
|
||||
async def next(self, ctx: commands.Context, num_launches: int = 1):
|
||||
# launches = await api.async_next_launches(num_launches)
|
||||
loop = asyncio.get_running_loop()
|
||||
|
||||
launches = await loop.run_in_executor(
|
||||
None, functools.partial(self.api.fetch_launch, num=num_launches)
|
||||
)
|
||||
|
||||
# launches = self.api.fetch_launch(num=num_launches)
|
||||
|
||||
print(len(launches))
|
||||
# loop = asyncio.get_running_loop()
|
||||
#
|
||||
# launches = await loop.run_in_executor(
|
||||
# None, functools.partial(self.api.fetch_launch, num=num_launches)
|
||||
# )
|
||||
#
|
||||
launches = await self.api.async_fetch_launch(num=num_launches)
|
||||
|
||||
async with ctx.typing():
|
||||
for x, launch in enumerate(launches):
|
||||
|
Loading…
x
Reference in New Issue
Block a user