GiftEvent triggered twice for one gift
I've noticed when one gift is sent, the gift event is triggered twice. This happens about 90% of the time.
Here's my code:
from TikTokLive.client.client import TikTokLiveClient from TikTokLive.client.logger import LogLevel from TikTokLive.events import ConnectEvent, GiftEvent
client: TikTokLiveClient = TikTokLiveClient( unique_id="@username" )
@client.on(ConnectEvent) async def on_connect(event: ConnectEvent): client.logger.info(f"Connected to @{event.unique_id}!")
@client.on(GiftEvent) async def on_gift(event: GiftEvent): client.logger.info(f"Recieved gift ID = {event.gift.id}!")
if name == 'main': # Enable debug info client.logger.setLevel(LogLevel.INFO.value)
# Connect
client.run()
This doesn't really sound like a bug, but rather how streaking is handled by TikTok. Please confirm you are not referring to streakable gifts, like Rose, which always fire a minimum of twice (once to start, once to let you know the streak is over).
Is there any way to fix it? When they send a rose, the action is done twice
It is not a bug. There is no "fix". Listen for the streak to finish!