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
"""
2
display_rooms.py
3
4
This example shows how to display all the rooms in the lobby.
5
"""
6
7
8
from
talkomatic
import
Bot
# import the Bot class from the talkomatic package
9
10
11
bot =
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
15
async 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
24
bot.run(
"Room Display"
,
"Bot"
)
talkomatic.bot.Bot
Definition
bot.py:16
display_rooms.on_connect
None on_connect()
Definition
display_rooms.py:15
examples
display_rooms.py
Generated by
1.13.2