add dev-env detection
This commit is contained in:
parent
cfc1a0b08c
commit
d6519d5133
1 changed files with 13 additions and 2 deletions
|
@ -17,12 +17,22 @@ async def get_git_status() -> dict:
|
|||
stdout=asyncio.subprocess.PIPE,
|
||||
stderr=asyncio.subprocess.PIPE
|
||||
)
|
||||
dv_proc = await asyncio.create_subprocess_exec("git", "diff", "HEAD",
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
stderr=asyncio.subprocess.PIPE
|
||||
)
|
||||
|
||||
stdout, _ = await id_proc.communicate()
|
||||
output["commit_id"] = stdout.decode("utf-8")
|
||||
|
||||
stdout, _ = await br_proc.communicate()
|
||||
output["branch"] = stdout.decode("utf-8")
|
||||
|
||||
stdout, _ = await dv_proc.communicate()
|
||||
if stdout.decode("utf-8") == "":
|
||||
output["dev"] = False
|
||||
else:
|
||||
output["dev"] = True
|
||||
except subprocess.SubprocessError as err:
|
||||
print(err)
|
||||
return output
|
||||
|
@ -43,8 +53,9 @@ async def info(ctx: lightbulb.Context) -> None:
|
|||
git_status = await get_git_status()
|
||||
embed = hikari.Embed(title="About Me!")
|
||||
embed.add_field("GitHub", "https://gitdab.com/InValidFire/radical-bot")
|
||||
embed.add_field("Version", git_status['commit_id'])
|
||||
embed.add_field("Branch", git_status['branch'])
|
||||
embed.add_field("Version", git_status['commit_id'], inline=True)
|
||||
embed.add_field("Branch", git_status['branch'], inline=True)
|
||||
embed.add_field("In Dev-Env?", git_status['dev'])
|
||||
await ctx.respond(embed)
|
||||
|
||||
def load(bot: lightbulb.BotApp):
|
||||
|
|
Loading…
Reference in a new issue