(hopefully) fixed get_url
This commit is contained in:
parent
498bdc0065
commit
4016e92ad9
1 changed files with 6 additions and 6 deletions
|
@ -12,12 +12,12 @@ class Pterodactyl(commands.Cog):
|
||||||
server_id="d6d05b41-4da5-4c5b-9ee6-6e25f61a596b"
|
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."""
|
"""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.")
|
raise LookupError("Server ID not set.")
|
||||||
base_url = self.config.guild(ctx.guild).base_url()
|
base_url = await self.config.guild(ctx.guild).base_url()
|
||||||
server_id = self.config.guild(ctx.guild).server_id()
|
server_id = await self.config.guild(ctx.guild).server_id()
|
||||||
url = f"https://{base_url}/api/client/servers/{server_id}/"
|
url = f"https://{base_url}/api/client/servers/{server_id}/"
|
||||||
if endpoint:
|
if endpoint:
|
||||||
url += endpoint
|
url += endpoint
|
||||||
|
@ -28,7 +28,7 @@ class Pterodactyl(commands.Cog):
|
||||||
"""This does stuff!"""
|
"""This does stuff!"""
|
||||||
# Your code will go here
|
# Your code will go here
|
||||||
if endpoint:
|
if endpoint:
|
||||||
url = self.get_url(ctx, endpoint)
|
url = await self.get_url(ctx, endpoint)
|
||||||
else:
|
else:
|
||||||
url = self.get_url(ctx)
|
url = await self.get_url(ctx)
|
||||||
await ctx.send(url)
|
await ctx.send(url)
|
||||||
|
|
Reference in a new issue