Add /branch command #1

Merged
InValidFire merged 12 commits from test into main 2022-08-20 16:07:54 +00:00
1 changed files with 4 additions and 4 deletions
Showing only changes of commit abd583401e - Show all commits

View File

@ -95,11 +95,11 @@ async def update(ctx: lightbulb.Context) -> None:
@lightbulb.add_checks(lightbulb.owner_only)
@lightbulb.command("branch", "get or set the working branch the bot uses.")
@lightbulb.implements(lightbulb.SlashCommandGroup)
async def branch(ctx: lightbulb.Context) -> None:
async def branch_group(ctx: lightbulb.Context) -> None:
pass # SlashCommandGroup body code isn't run
@branch.child
@branch_group.child
@lightbulb.add_checks(lightbulb.owner_only)
@lightbulb.command("get", "get the current branch", ephemeral=True)
@lightbulb.implements(lightbulb.SlashSubCommand)
@ -110,7 +110,7 @@ async def branch_get(ctx: lightbulb.Context) -> None:
await ctx.respond(embed=embed)
@branch.child
@branch_group.child
@lightbulb.add_checks(lightbulb.owner_only)
@lightbulb.option("name", "name of the branch", type=str, required=True)
@lightbulb.command("switch", "switch branches", ephemeral=True)
@ -119,7 +119,7 @@ async def branch_switch(ctx: lightbulb.Context) -> None:
embed = hikari.Embed(title="Restarting",
description="Restarting to switch branches!"
)
output = await create_subprocess("git", "switch", ctx.options.branch)
output = await create_subprocess("git", "switch", ctx.options.name)
if "invalid reference" in output: # parsing output allows us more specificity.
embed.title = "Branch does not exist."
embed.description = "Please check your spelling."