(hopefully) fixed get_url

This commit is contained in:
Seaswimmer 2023-07-14 11:11:42 -04:00
parent 498bdc0065
commit 4016e92ad9
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -12,12 +12,12 @@ class Pterodactyl(commands.Cog):
server_id="d6d05b41-4da5-4c5b-9ee6-6e25f61a596b"
)
def get_url(self, ctx, endpoint = None):
async def get_url(self, ctx, endpoint = None):
"""Returns the base url for the Servers API, or the url for a specific endpoint if one is provided."""
if not self.config.guild(ctx.guild).server_id():
if not await self.config.guild(ctx.guild).server_id():
raise LookupError("Server ID not set.")
base_url = self.config.guild(ctx.guild).base_url()
server_id = self.config.guild(ctx.guild).server_id()
base_url = await self.config.guild(ctx.guild).base_url()
server_id = await self.config.guild(ctx.guild).server_id()
url = f"https://{base_url}/api/client/servers/{server_id}/"
if endpoint:
url += endpoint
@ -28,7 +28,7 @@ class Pterodactyl(commands.Cog):
"""This does stuff!"""
# Your code will go here
if endpoint:
url = self.get_url(ctx, endpoint)
url = await self.get_url(ctx, endpoint)
else:
url = self.get_url(ctx)
url = await self.get_url(ctx)
await ctx.send(url)