diff --git a/ext/system.py b/ext/system.py index 43c77a2..548819e 100644 --- a/ext/system.py +++ b/ext/system.py @@ -78,6 +78,19 @@ async def ping(ctx: lightbulb.Context) -> None: ) await ctx.respond(embed) +@plugin.command +@lightbulb.add_checks(lightbulb.owner_only) +@lightbulb.command("update", "update the bot!", ephemeral=True) +@lightbulb.implements(lightbulb.SlashCommand) +async def update(ctx: lightbulb.Context) -> None: + if (await get_git_status())['dev'] is False: + await create_subprocess("git", "pull") + embed = hikari.Embed(title="Restarting", + description="Restarting to load an update!" + ) + await ctx.respond(embed) + await ctx.bot.close() + @plugin.command @lightbulb.command("info", "get bot information such as the version, and repository link.", ephemeral=True) @lightbulb.implements(lightbulb.SlashCommand) diff --git a/install b/install new file mode 100644 index 0000000..64e1cd4 --- /dev/null +++ b/install @@ -0,0 +1,6 @@ +addgroup radical-bot +adduser --system --home /otp/radical-bot --ingroup radical-bot radical-bot +sudo -u radical-bot git clone https://gitdab.com/InValidFire/radical-bot.git /otp/radical-bot +sudo -u radical-bot python3.9 -m pip install -r /otp/radical-bot/requirements.txt +cp radical-bot.service /etc/systemd/system +systemd enable radical-bot diff --git a/radical-bot.service b/radical-bot.service new file mode 100644 index 0000000..868e362 --- /dev/null +++ b/radical-bot.service @@ -0,0 +1,15 @@ +[Unit] +Description=Radical Bot Daemon +After=network.target +StartLimitIntervalSec=0 + +[Service] +WorkingDirectory=/otp/radical-bot +User=radical-bot +Group=radical-bot +Restart=always +RestartSec=20 3 +ExecStart=/usr/bin/env python3.9 main.py + +[Install] +WantedBy=multi.user.target