bot: Parse new licence api
This commit is contained in:
parent
ebc4ac0b5f
commit
dbb4233058
@ -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
|
||||||
```
|
```
|
@ -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)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user