Socket
Socket
Sign inDemoInstall

tiktok-live-connector

Package Overview
Dependencies
84
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.9.18 to 0.9.19

2

package.json
{
"name": "tiktok-live-connector",
"version": "0.9.18",
"version": "0.9.19",
"description": "Node.js module to receive live stream chat events like comments and gifts from TikTok LIVE",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -241,3 +241,3 @@ # TikTok-Live-Connector

> **NOTE:** Users have the capability to send gifts in a streak. This increases the `data.gift.repeat_count` value until the user terminates the streak. During this time new gift events are triggered again and again with an increased `data.gift.repeat_count` value. It should be noted that after the end of the streak, another gift event is triggered, which signals the end of the streak via `data.gift.repeat_end`:`1`. This applies only to gifts with `data.gift.gift_type`:`1`. This means that even if the user sends a `gift_type`:`1` gift only once, you will receive the event twice. Once with `repeat_end`:`0` and once with `repeat_end`:`1`. Therefore, the event should be handled as follows:
> **NOTE:** Users have the capability to send gifts in a streak. This increases the `repeatCount` value until the user terminates the streak. During this time new gift events are triggered again and again with an increased `repeatCount` value. It should be noted that after the end of the streak, another gift event is triggered, which signals the end of the streak via `repeatEnd`:`true`. This applies only to gifts with `giftType`:`1`. This means that even if the user sends a `giftType`:`1` gift only once, you will receive the event twice. Once with `repeatEnd`:`false` and once with `repeatEnd`:`true`. Therefore, the event should be handled as follows:

@@ -247,8 +247,8 @@

tiktokChatConnection.on('gift', data => {
if (data.gift.gift_type === 1 && data.gift.repeat_end === 0) {
if (data.giftType === 1 && !data.repeatEnd) {
// Streak in progress => show only temporary
console.log(`${data.uniqueId} is sending gift ${data.giftId} x${data.gift.repeat_count}`);
console.log(`${data.uniqueId} is sending gift ${data.giftName} x${data.repeatCount}`);
} else {
// Streak ended or non-streakable gift => process the gift with final repeat_count
console.log(`${data.uniqueId} has sent gift ${data.giftId} x${data.gift.repeat_count}`);
console.log(`${data.uniqueId} has sent gift ${data.giftName} x${data.repeatCount}`);
}

@@ -262,40 +262,20 @@ })

{
userId: '6776663624629974121',
// User Details
userId: '6976651226482787334',
uniqueId: 'zerodytester',
nickname: 'Zerody One',
profilePictureUrl: 'https://p16-sign-va.tiktokcdn.com/...',
gift: {
gift_id: 5729,
gift_type: 2,
repeat_count: 1,
repeat_end: 0,
to_user_id: 6929592145315251000
},
giftId: 5729,
// Extended info is present if you have enabled the 'enableExtendedGiftInfo' option
followRole: 0,
profilePictureUrl: 'https://p16-sign.tiktokcdn-us.com/...',
// Gift Details
giftId: 5655,
repeatCount: 1,
repeatEnd: true,
userBadges: [],
describe: 'Sent Rose',
giftType: 1,
diamondCount: 1,
giftName: 'Rose',
giftPictureUrl: 'https://p19-webcast.tiktokcdn.com/...',
extendedGiftInfo: {
describe: 'sent Rose',
diamond_count: 1,
duration: 1000,
icon: {
avg_color: '#A3897C',
is_animated: false,
url_list: [
// Icon URLs...
]
},
id: 5655,
image: {
avg_color: '#FFEBEB',
is_animated: false,
url_list: [
// Image URLs...
]
},
is_broadcast_gift: false,
is_displayed_on_panel: true,
is_effect_befview: false,
item_type: 1,
name: 'Rose',
type: 1
// This will be filled when you enable the `enableExtendedGiftInfo` option
}

@@ -302,0 +282,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc