talkomatic.py 0.1.2
An easy-to-use Python versatile wrapper for the Talkomatic Bot interface ensuring best practices for making bots, and handling the REST API.
 
Loading...
Searching...
No Matches
display_rooms.py
Go to the documentation of this file.
1"""
2display_rooms.py
3
4This example shows how to display all the rooms in the lobby.
5"""
6
7
8from talkomatic import Bot # import the Bot class from the talkomatic package
9
10
11bot = Bot() # create a new Bot instance
12
13# with this decorator, the function will be called when the bot finishes connecting to the server
14@bot.on_connect
15async def on_connect() -> None:
16 # for each room in the lobby, we print the room
17 for room in bot.rooms:
18 print(room)
19
20 # we're done, so we can disconnect
21 await bot.disconnect()
22
23# we're ready to go! let's run the bot with a username and location
24bot.run("Room Display", "Bot")