bot: Added initial commands
All checks were successful
Build Docker / Build Master (push) Successful in 23s
Build Docker / Build Bot (push) Successful in 26s

This commit is contained in:
Nathan Woodburn 2023-08-17 16:34:58 +10:00
parent aa99339d4f
commit ffe95d87fc
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

View File

@ -38,6 +38,27 @@ async def listworkers(ctx):
else: else:
await ctx.response.send_message("You do not have permission to use this command",ephemeral=True) await ctx.response.send_message("You do not have permission to use this command",ephemeral=True)
@tree.command(name="licence", description="Gets a licence key")
async def license(ctx):
if ctx.author.id != ADMINID:
await ctx.response.send_message("You do not have permission to use this command",ephemeral=True)
return
r = requests.get(f"http://{Master_IP}:{Master_Port}/add-licence",headers={"key":os.getenv('LICENCE_KEY')})
if r.status_code == 200:
await ctx.response.send_message(r.text,ephemeral=True)
else:
await ctx.response.send_message(f"Error getting license\n" + r.text,ephemeral=True)
@tree.command(name="createsite", description="Create a new WordPress site")
async def createsite(ctx, domain: str, licence: str):
r = requests.get(f"http://{Master_IP}:{Master_Port}/create-site?domain={domain}",headers={"key":os.getenv('licence')})
if r.status_code == 200:
await ctx.response.send_message(r.text,ephemeral=False)
else:
await ctx.response.send_message(f"Error creating site\n" + r.text,ephemeral=False)
# When the bot is ready # When the bot is ready
@client.event @client.event
async def on_ready(): async def on_ready():
@ -46,4 +67,4 @@ async def on_ready():
await tree.sync() await tree.sync()
await client.loop.create_task(client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="over HNSHosting wordpress"))) await client.loop.create_task(client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="over HNSHosting wordpress")))
client.run(TOKEN) client.run(TOKEN)