async def sh(self, ctx, *, command): """Runs a shell command.""" async with ctx.typing(): stdout, stderr = await self.run_process(command) if stderr: text = f'stdout:\n{stdout}\nstderr:\n{stderr}' else: text = stdout try: pages = paginator.TextPages(ctx, text) await pages.paginate() except Exception as e: await ctx.send(str(e))
async def restart(self, ctx, who): cmd = f"systemctl restart {who}" async with ctx.typing(): stdout, stderr = await self.run_process(cmd) if stderr: text = f'stdout:\n{stdout}\nstderr:\n{stderr}' else: text = stdout try: pages = paginator.TextPages(ctx, text) await pages.paginate() except Exception as e: await ctx.send(str(e))