From 41e180c79aba02b30e0c701d368cb4176708d756 Mon Sep 17 00:00:00 2001 From: nexy7574 Date: Sun, 8 Sep 2024 02:27:01 +0100 Subject: [PATCH] fix runas, again --- app/modules/evaluation.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/modules/evaluation.py b/app/modules/evaluation.py index 3ef433f..d462e9d 100644 --- a/app/modules/evaluation.py +++ b/app/modules/evaluation.py @@ -200,11 +200,15 @@ class EvalModule(niobot.Module): @niobot.command() @niobot.is_owner() - async def runas(self, ctx: niobot.Context, user: str, command: str, *args: str): + async def runas(self, ctx: niobot.Context, user: str, command: str, *args): """Run a command as another user.""" + if args and args[0] == "%null%": + args = tuple() event = ctx.event event.sender = user - event.body = f"{command} {' '.join(args)}" + event.body = command + if args: + event.body += " " + " ".join(args) try: result = await self.bot.process_message(event) await ctx.respond(f"Result of runas: `{result!r}`")