This commit is contained in:
Nexus 2024-09-08 02:27:51 +01:00
parent 41e180c79a
commit 2c8ff7e8d4

View file

@ -200,7 +200,7 @@ class EvalModule(niobot.Module):
@niobot.command() @niobot.command()
@niobot.is_owner() @niobot.is_owner()
async def runas(self, ctx: niobot.Context, user: str, command: str, *args): async def runas(self, ctx: niobot.Context, user: str, command: str, *args: str):
"""Run a command as another user.""" """Run a command as another user."""
if args and args[0] == "%null%": if args and args[0] == "%null%":
args = tuple() args = tuple()
@ -210,7 +210,7 @@ class EvalModule(niobot.Module):
if args: if args:
event.body += " " + " ".join(args) event.body += " " + " ".join(args)
try: try:
result = await self.bot.process_message(event) result = await self.bot.process_message(ctx.room, event)
await ctx.respond(f"Result of runas: `{result!r}`") await ctx.respond(f"Result of runas: `{result!r}`")
except Exception as e: except Exception as e:
await ctx.respond(f"Error in runas process: `{e!r}`") await ctx.respond(f"Error in runas process: `{e!r}`")