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):
|
||||
"""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:
|
||||
raise LookupError("Server ID not set.")
|
||||
elif await self.config.guild(guild).base_url() is None:
|
||||
raise LookupError("Base URL not set.")
|
||||
base_url = await self.config.guild(guild).base_url()
|
||||
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:
|
||||
url += endpoint
|
||||
url += '/' + endpoint
|
||||
return url
|
||||
|
||||
async def put(self, url: str, headers: dict, data: dict):
|
||||
|
|
Reference in a new issue