17 lines
		
	
	
	
		
			475 B
		
	
	
	
		
			Python
		
	
	
	
	
	
		
		
			
		
	
	
			17 lines
		
	
	
	
		
			475 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| 
								 | 
							
								from nio import AsyncClient
							 | 
						||
| 
								 | 
							
								import asyncio, os
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								from dotenv import load_dotenv
							 | 
						||
| 
								 | 
							
								load_dotenv()  # this must run **before** os.environ access
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								async def get_room_id():
							 | 
						||
| 
								 | 
							
								    client = AsyncClient("http://localhost:8008", "@einszwovier_bot:localhost")
							 | 
						||
| 
								 | 
							
								    await client.login(os.environ["MATRIX_PASS"])
							 | 
						||
| 
								 | 
							
								    await client.join("#2D-prints:localhost")
							 | 
						||
| 
								 | 
							
								    rooms = await client.joined_rooms()
							 | 
						||
| 
								 | 
							
								    print("Joined rooms:", rooms.rooms)
							 | 
						||
| 
								 | 
							
								    await client.close()
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								asyncio.run(get_room_id())
							 |