misc: minor changes to get_url
This commit is contained in:
parent
55067cb269
commit
9be254e983
1 changed files with 3 additions and 3 deletions
|
@ -20,16 +20,16 @@ class Pterodactyl(commands.Cog):
|
||||||
)
|
)
|
||||||
|
|
||||||
async def get_url(self, guild, endpoint = None):
|
async def get_url(self, guild, endpoint = None):
|
||||||
"""Returns the base url for the Servers API, or the url for a specific API endpoint if one is provided."""
|
"""Returns the base url for the server's API, or the url for a specific API endpoint if one is provided."""
|
||||||
if await self.config.guild(guild).server_id() is None:
|
if await self.config.guild(guild).server_id() is None:
|
||||||
raise LookupError("Server ID not set.")
|
raise LookupError("Server ID not set.")
|
||||||
elif await self.config.guild(guild).base_url() is None:
|
elif await self.config.guild(guild).base_url() is None:
|
||||||
raise LookupError("Base URL not set.")
|
raise LookupError("Base URL not set.")
|
||||||
base_url = await self.config.guild(guild).base_url()
|
base_url = await self.config.guild(guild).base_url()
|
||||||
server_id = await self.config.guild(guild).server_id()
|
server_id = await self.config.guild(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
|
||||||
return url
|
return url
|
||||||
|
|
||||||
async def put(self, url: str, headers: dict, data: dict):
|
async def put(self, url: str, headers: dict, data: dict):
|
||||||
|
|
Reference in a new issue