TikTokLive icon indicating copy to clipboard operation
TikTokLive copied to clipboard

GiftEvent triggered twice for one gift

Open lduvex opened this issue 1 year ago • 3 comments

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()

lduvex avatar Apr 05 '24 06:04 lduvex

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).

isaackogan avatar Apr 06 '24 19:04 isaackogan

Is there any way to fix it? When they send a rose, the action is done twice

GaskyGod avatar Apr 24 '24 08:04 GaskyGod

It is not a bug. There is no "fix". Listen for the streak to finish!

isaackogan avatar Apr 24 '24 16:04 isaackogan