Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GiftEvent triggered twice for one gift #211

Open
lduvex opened this issue Apr 5, 2024 · 3 comments
Open

GiftEvent triggered twice for one gift #211

lduvex opened this issue Apr 5, 2024 · 3 comments

Comments

@lduvex
Copy link

lduvex commented Apr 5, 2024

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()
@isaackogan
Copy link
Owner

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

@GaskyGod
Copy link

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

@isaackogan
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants