fix runas, again

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

View file

@ -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}`")