1
Fork 0
mirror of https://github.com/wlinator/luminara.git synced 2024-10-02 18:03:12 +00:00

Add /restart command

This commit is contained in:
wlinator 2023-06-19 11:20:38 -04:00
parent f6290ea966
commit 7636d9d6f9

View file

@ -1,4 +1,5 @@
import asyncio
import subprocess
import discord
from discord.ext import commands
@ -18,6 +19,20 @@ class Basic(commands.Cog):
async def ping(self, ctx):
await ctx.respond(f"SB latency: {round(self.bot.latency * 1000, 2)} ms")
@commands.slash_command(
name="restart",
description="Restart and update the bot - owner only command.",
guild_only=True
)
@commands.check(universal.owner_check)
async def restart(self, ctx):
try:
output = subprocess.check_output(["/bin/bash", "racu_update.sh"])
except subprocess.CalledProcessError as e:
output = f"ERROR!!!\n{e.output.decode()}"
await ctx.respond(f"Script executed:\n```\n{output}\n```", ephemeral=True)
@commands.slash_command(
name="intro",
guild_only=False,