diff --git a/pterodactyl/ptero.py b/pterodactyl/ptero.py index 121dce3..93e40bf 100644 --- a/pterodactyl/ptero.py +++ b/pterodactyl/ptero.py @@ -7,15 +7,17 @@ class Pterodactyl(commands.Cog): self.bot = bot self.config = Config.get_conf(self, identifier=457581387213637448123567) self.config.register_guild( - base_url="pterodactyl.file.properties", + base_url="mc.bloom.host", api_key=None, - server_id="d6d05b41-4da5-4c5b-9ee6-6e25f61a596b" + server_id=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 await self.config.guild(ctx.guild).server_id(): raise LookupError("Server ID not set.") + elif not await self.config.guild(ctx.guild).base_url(): + raise LookupError("Base URL not set.") 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}/" @@ -26,9 +28,11 @@ class Pterodactyl(commands.Cog): @commands.command() async def test(self, ctx, endpoint = None): """This does stuff!""" - # Your code will go here - if endpoint: - url = await self.get_url(ctx, endpoint) - else: - url = await self.get_url(ctx) + try: + if endpoint: + url = await self.get_url(ctx, endpoint) + else: + url = await self.get_url(ctx) + except LookupError as e: + await ctx.send(f"Something went wrong.\n{e}") await ctx.send(url)