diff --git a/main.py b/main.py new file mode 100644 index 0000000..2495b9d --- /dev/null +++ b/main.py @@ -0,0 +1,24 @@ +from TikTokLive import TikTokLiveClient +from TikTokLive.events import ConnectEvent, CommentEvent + +# Create the client +client: TikTokLiveClient = TikTokLiveClient(unique_id="@isaackogz") + + +# Listen to an event with a decorator! +@client.on(ConnectEvent) +async def on_connect(event: ConnectEvent): + print(f"Connected to @{event.unique_id} (Room ID: {client.room_id}") + + +# Or, add it manually via "client.add_listener()" +async def on_comment(event: CommentEvent) -> None: + print(f"{event.user.nickname} -> {event.comment}") + + +client.add_listener(CommentEvent, on_comment) + +if __name__ == '__main__': + # Run the client and block the main thread + # await client.start() to run non-blocking + client.run() \ No newline at end of file