bot: Added site info command
This commit is contained in:
parent
a626248564
commit
ec052b4ec1
@ -69,13 +69,25 @@ async def createsite(ctx, domain: str, licence: str):
|
|||||||
if r.status_code == 200:
|
if r.status_code == 200:
|
||||||
json = r.json()
|
json = r.json()
|
||||||
if json['success'] == "true":
|
if json['success'] == "true":
|
||||||
await ctx.response.send_message(f"Site {domain} creating...\nPlease send /siteinfo domain:{domain}")
|
await ctx.response.send_message(f"Site {domain} creating...\nPlease wait a few minutes and then send /siteinfo domain:{domain}")
|
||||||
else:
|
else:
|
||||||
await ctx.response.send_message(f"Error creating site\n" + json['error'])
|
await ctx.response.send_message(f"Error creating site\n" + json['error'])
|
||||||
else:
|
else:
|
||||||
await ctx.response.send_message(f"Error creating site\n" + r.text)
|
await ctx.response.send_message(f"Error creating site\n" + r.text)
|
||||||
|
|
||||||
|
|
||||||
|
@tree.command(name="siteinfo", description="Get info about a WordPress site")
|
||||||
|
async def siteinfo(ctx, domain: str):
|
||||||
|
r = requests.get(f"http://{Master_IP}:{Master_Port}/site-info?domain={domain}")
|
||||||
|
if r.status_code == 200:
|
||||||
|
json = r.json()
|
||||||
|
if json['success'] == "true":
|
||||||
|
await ctx.response.send_message(f"Site: {domain}\nStatus: {json['status']}\nWorker: {json['worker']}")
|
||||||
|
else:
|
||||||
|
await ctx.response.send_message(f"Error getting site info\n" + json['error'])
|
||||||
|
else:
|
||||||
|
await ctx.response.send_message(f"Error getting site info\n" + r.text)
|
||||||
|
|
||||||
# When the bot is ready
|
# When the bot is ready
|
||||||
@client.event
|
@client.event
|
||||||
async def on_ready():
|
async def on_ready():
|
||||||
|
@ -203,13 +203,9 @@ def site_status():
|
|||||||
|
|
||||||
if "tlsa" in json:
|
if "tlsa" in json:
|
||||||
tlsa = json['tlsa']
|
tlsa = json['tlsa']
|
||||||
|
return jsonify({'success': 'true', 'domain': domain, 'ip': ip, 'tlsa': tlsa})
|
||||||
else:
|
else:
|
||||||
tlsa = "none"
|
return jsonify({'success': 'false', 'domain': domain, 'ip': ip, 'tlsa': 'none','error': 'No TLSA record found'})
|
||||||
|
|
||||||
# Return status
|
|
||||||
|
|
||||||
|
|
||||||
return jsonify({'success': 'true', 'domain': domain, 'ip': ip, 'tlsa': tlsa})
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/tlsa', methods=['GET'])
|
@app.route('/tlsa', methods=['GET'])
|
||||||
|
Loading…
Reference in New Issue
Block a user