fix runas, again
This commit is contained in:
parent
dd271bf4cc
commit
41e180c79a
1 changed files with 6 additions and 2 deletions
|
@ -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}`")
|
||||
|
|
Loading…
Reference in a new issue