Comments (2)
from TikTokLive import TikTokLiveClient
from TikTokLive.events import CommentEvent, ConnectEvent
await asyncio.sleep(30)
client: TikTokLiveClient = TikTokLiveClient(unique_id=username)
@client.on("connect")
async def on_connect(event: ConnectEvent):
st.success("Successful connection to ROOM ID: {}".format(client.room_id))
@client.on("comment")
async def on_comment(event: CommentEvent):
# Update prompt_parts with new comments and return to original content after every reading
prompt_parts[0] = original_prompt + f" There is a new comment from you with the nick name {event.user.nickname}: {event.comment}?, read through and reply"
st.session_state['latest_comment'] = event.comment
st.success(f"{event.user.nickname} -> {event.comment}")
now, i get an error :
AttributeError: 'str' object has no attribute 'get_type'
Traceback:
File "C:\Users\KalvinThien\AppData\Roaming\Python\Python311\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 535, in _run_script
exec(code, module.dict)
File "D:\tech_review\edit_video\Ewrite\Full_web\pages\Etool_source\Full_Code_Etools\Live_stream_voice_Ai_Khong_comment.py", line 567, in
asyncio.run(main())
File "C:\Users\KalvinThien\AppData\Local\Programs\Python\Python311\Lib\site-packages\nest_asyncio.py", line 30, in run
return loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\KalvinThien\AppData\Local\Programs\Python\Python311\Lib\site-packages\nest_asyncio.py", line 98, in run_until_complete
return f.result()
^^^^^^^^^^
File "C:\Users\KalvinThien\AppData\Local\Programs\Python\Python311\Lib\asyncio\futures.py", line 203, in result
raise self._exception.with_traceback(self._exception_tb)
File "C:\Users\KalvinThien\AppData\Local\Programs\Python\Python311\Lib\asyncio\tasks.py", line 277, in __step
result = coro.send(None)
^^^^^^^^^^^^^^^
File "D:\tech_review\edit_video\Ewrite\Full_web\pages\Etool_source\Full_Code_Etools\Live_stream_voice_Ai_Khong_comment.py", line 466, in main
@client.on("connect")
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\KalvinThien\AppData\Local\Programs\Python\Python311\Lib\site-packages\TikTokLive\client\client.py", line 275, in on
return super(TikTokLiveClient, self).on(event.get_type(), f)
^^^^^^^^^^^^^^
from tiktoklive.
Need more info. Explain your issue. I will not read your stacktrace to guess.
from tiktoklive.
Related Issues (20)
- TikTokLive.client.errors.UserOfflineError HOT 2
- Gift examples doesnt work anymore "count" HOT 2
- SendMessage Method HOT 1
- httpx.Timeout Error HOT 4
- Unexpected error fetching when user is offline HOT 2
- Video download failed after few time later HOT 3
- Failed to fetch room id from Webcast, see stacktrace for more info. HOT 2
- GiftEvent triggered twice for one gift HOT 3
- pay_grade is always empty in RoomUserSeqEvent HOT 1
- pull request HOT 1
- TypeError: string indices must be integers, not 'str' HOT 1
- Passing room_id to the start method returns error from the sign API HOT 2
- Automatic off event data capture but user still live HOT 7
- Error when downloading livestream from 1 number of users HOT 1
- AttributeError: 'str' object has no attribute 'get_type' HOT 1
- Detecting user exit from live HOT 3
- raise mapped_exc(message) from exc httpx.ReadTimeout
- Failed request to Sign API with status code 503 and payload "b'{"code":503,"error":"API is not ready for connections yet."}'". HOT 1
- Get the previous user_id that comment before joined live
- Download stopped no exception
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tiktoklive.