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