bot: Parse new licence api
All checks were successful
Build Docker / Build Master (push) Successful in 23s
Build Docker / Build Bot (push) Successful in 25s

This commit is contained in:
Nathan Woodburn 2023-08-24 13:42:10 +10:00
parent ebc4ac0b5f
commit dbb4233058
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
2 changed files with 6 additions and 3 deletions

View File

@ -53,5 +53,5 @@ curl -X POST http://master-server-ip:5000/add-worker?worker=worker-name&ip=worke
Docker install Docker install
``` ```
docker run -d -e MASTER_IP=<MASTER SERVER IP> -e DISCORD_TOKEN=<YOUR-BOT-TOKEN> -e LICENCE-API=your-api-key -e WORKER_KEY=your-api-key --name hnshosting-bot git.woodburn.au/nathanwoodburn/hnshosting-bot:latest docker run -d -e MASTER_IP=<MASTER SERVER IP> -e DISCORD_TOKEN=<YOUR-BOT-TOKEN> -e LICENCE_KEY=your-api-key -e WORKER_KEY=your-api-key --name hnshosting-bot git.woodburn.au/nathanwoodburn/hnshosting-bot:latest
``` ```

View File

@ -41,7 +41,6 @@ async def listworkers(ctx):
await ctx.response.send_message(json['workers'],ephemeral=True) await ctx.response.send_message(json['workers'],ephemeral=True)
else: else:
await ctx.response.send_message(f"Error listing workers\n" + json['error'],ephemeral=True) await ctx.response.send_message(f"Error listing workers\n" + json['error'],ephemeral=True)
await ctx.response.send_message(r.text,ephemeral=True)
else: else:
await ctx.response.send_message(f"Error listing workers\n" + r.text,ephemeral=True) await ctx.response.send_message(f"Error listing workers\n" + r.text,ephemeral=True)
else: else:
@ -56,7 +55,11 @@ async def license(ctx):
r = requests.post(f"http://{Master_IP}:{Master_Port}/add-licence",headers={"key":os.getenv('LICENCE_KEY')}) r = requests.post(f"http://{Master_IP}:{Master_Port}/add-licence",headers={"key":os.getenv('LICENCE_KEY')})
if r.status_code == 200: if r.status_code == 200:
await ctx.response.send_message(r.text,ephemeral=True) json = r.json()
if json['success'] == "true":
await ctx.response.send_message(json['licence_key'])
else:
await ctx.response.send_message(f"Error getting license\n" + json['error'])
else: else:
await ctx.response.send_message(f"Error getting license\n" + r.text,ephemeral=True) await ctx.response.send_message(f"Error getting license\n" + r.text,ephemeral=True)