diff --git a/app/modules/evaluation.py b/app/modules/evaluation.py index a2d2890..7b4f557 100644 --- a/app/modules/evaluation.py +++ b/app/modules/evaluation.py @@ -220,3 +220,22 @@ class EvalModule(niobot.Module): await ctx.respond(f"Result of runas: `{result!r}`") except Exception as e: await ctx.respond(f"Error in runas process: `{e!r}`") + + @niobot.command() + @niobot.is_owner() + async def rooms(self, ctx: niobot.Context, operation: str, room: str = None): + """room management""" + match operation.casefold(): + case "join": + result = await self.bot.join(room) + return await ctx.respond(repr(result)) + case "leave": + if room.startswith("#"): + resolved = await self.bot.room_resolve_alias(room) + if not isinstance(resolved, niobot.RoomResolveAliasResponse): + return await ctx.respond("Failed to resolve room ID for: %r", room) + room = resolved.room_id + response = await self.bot.room_leave(room) + return await ctx.respond(repr(response)) + case _: + return await ctx.respond("Unknown operation.")