Breaking changes:

'Gift': changed from class to enum, so now you can handle
incoming gifts in switch

`Events`
- new:
     onGiftComboFinished
- Removed:
      onGiftBrodcast
- Rename:
     onGiftMessage -> onGift
     onRoomPinMessage -> onRoomPin
     onRoomMessage -> onRoom
     onLinkMessage -> onLink
     onBarrageMessage -> onBarrage
     onPollMessage -> onPoll
     onShopMessage -> onShop
     onDetectMessage -> onDetect

`GiftManager`
   added:
      registerGift
      findById
      findByName
      getGifts
   removed:
      getActiveGifts
This commit is contained in:
JW
2023-10-05 02:25:10 +02:00
parent e76703eae6
commit f55cbcae7e
106 changed files with 75409 additions and 3191 deletions

View File

@@ -69,13 +69,13 @@ public class ClientSettings {
/**
* Optional: Use it if you need to change tiktok live hostname in builder
* Optional: Use it if you need to change TikTok live hostname in builder
*/
private String hostName;
/**
* Parameters used in requests to Tiktok api
* Parameters used in requests to TikTok api
*/
private Map<String, Object> clientParameters;

View File

@@ -48,16 +48,11 @@ public class Constants {
* Default TimeOut for Connections
*/
public static final int DEFAULT_TIMEOUT = 20;
/**
* Default Polling-Time for Socket-Connection
*/
public static final int DEFAULT_POLLTIME = 1;
/**
* Default Settings for Client
*/
public static ClientSettings DefaultClientSettings() {
var clientSettings = new ClientSettings();
clientSettings.setTimeout(Duration.ofSeconds(DEFAULT_TIMEOUT));
@@ -75,8 +70,6 @@ public class Constants {
/**
* Default Parameters for HTTP-Request
*/
public static Map<String, Object> DefaultClientParams() {
var clientParams = new TreeMap<String, Object>();
clientParams.put("aid", 1988);

View File

@@ -23,6 +23,14 @@
package io.github.jwdeveloper.tiktok.events;
import io.github.jwdeveloper.tiktok.events.messages.*;
import io.github.jwdeveloper.tiktok.events.messages.TikTokConnectedEvent;
import io.github.jwdeveloper.tiktok.events.messages.TikTokDisconnectedEvent;
import io.github.jwdeveloper.tiktok.events.messages.TikTokGiftComboFinishedEvent;
import io.github.jwdeveloper.tiktok.events.messages.TikTokGiftEvent;
import io.github.jwdeveloper.tiktok.events.messages.TikTokJoinEvent;
import io.github.jwdeveloper.tiktok.events.messages.TikTokLikeEvent;
import io.github.jwdeveloper.tiktok.events.messages.TikTokBarrageEvent;
import io.github.jwdeveloper.tiktok.events.messages.poll.TikTokPollEvent;
public interface TikTokEventBuilder<T> {

View File

@@ -23,7 +23,7 @@
package io.github.jwdeveloper.tiktok.events.base;
import io.github.jwdeveloper.tiktok.events.TikTokEvent;
import io.github.jwdeveloper.tiktok.messages.*;
import io.github.jwdeveloper.tiktok.messages.data.Common;
import lombok.Getter;
@Getter
@@ -36,26 +36,6 @@ public class TikTokHeaderEvent extends TikTokEvent {
this(header.getMsgId(), header.getRoomId(), header.getCreateTime());
}
public TikTokHeaderEvent(MessageHeader header) {
this(header.getMessageId(), header.getRoomId(), header.getTimeStamp1());
}
public TikTokHeaderEvent(GiftMessageHeader header) {
this(header.getMessageId(), header.getRoomId(), header.getTimeStamp1());
}
public TikTokHeaderEvent(MemberMessageHeader header) {
this(header.getMessageId(), header.getRoomId(), header.getTimeStamp1());
}
public TikTokHeaderEvent(SocialMessageHeader header) {
this(header.getMessageId(), header.getRoomId(), header.getTimeStamp1());
}
public TikTokHeaderEvent(LikeMessageHeader header) {
this(header.getMessageId(), header.getRoomId(), header.getTimeStamp1());
}
public TikTokHeaderEvent(long messageId, long roomId, long timeStamp) {
this.messageId = messageId;
this.roomId = roomId;

View File

@@ -25,33 +25,40 @@ package io.github.jwdeveloper.tiktok.events.messages;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.events.objects.BarrageData;
import io.github.jwdeveloper.tiktok.events.objects.Picture;
import io.github.jwdeveloper.tiktok.events.objects.User;
import io.github.jwdeveloper.tiktok.messages.WebcastBarrageMessage;
import lombok.Value;
import io.github.jwdeveloper.tiktok.events.objects.barrage.BarrageParam;
import io.github.jwdeveloper.tiktok.events.objects.barrage.FansLevelParam;
import io.github.jwdeveloper.tiktok.events.objects.barrage.SubscribeGiftParam;
import io.github.jwdeveloper.tiktok.events.objects.barrage.UserGradeParam;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastBarrageMessage;
import lombok.Getter;
@Value
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokBarrageEvent extends TikTokHeaderEvent {
Picture picture;
Picture picture2;
Picture picture3;
User user;
BarrageData barrageData;
private final Picture icon;
private final Picture backGround;
private final Picture rightIcon;
private final String eventName;
private final int duration;
private BarrageParam barrageParam;
public TikTokBarrageEvent(WebcastBarrageMessage msg) {
super(msg.getHeader());
picture = Picture.Map(msg.getImage());
picture2 = Picture.Map(msg.getImage2());
picture3 = Picture.Map(msg.getImage3());
user = new User(msg.getUserData().getUser());
barrageData = new BarrageData(msg.getMessage().getEventType(),
msg.getMessage().getLabel(),
msg.getMessage().getData1List().stream().map(e ->
{
var user = new User(e.getUser().getUser());
return new BarrageData.BarrageUser(user, e.getData2());
}).toList()
);
super(msg.getCommon());
icon = Picture.Map(msg.getIcon());
eventName = msg.getEvent().getEventName();
backGround = Picture.Map(msg.getBackground());
rightIcon = Picture.Map(msg.getRightIcon());
duration = msg.getDuration();
switch (msg.getMsgType()) {
case GRADEUSERENTRANCENOTIFICATION:
barrageParam = new UserGradeParam(msg.getUserGradeParam());
case FANSLEVELUPGRADE:
barrageParam = new FansLevelParam(msg.getFansLevelParam());
case SUBSCRIBEGIFT:
barrageParam = new SubscribeGiftParam(msg.getSubscribeGiftParam());
default:
barrageParam = new BarrageParam();
}
}
}

View File

@@ -25,7 +25,7 @@ package io.github.jwdeveloper.tiktok.events.messages;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.messages.WebcastCaptionMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastCaptionMessage;
import lombok.Value;
@Value

View File

@@ -27,40 +27,29 @@ import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.events.objects.Picture;
import io.github.jwdeveloper.tiktok.events.objects.User;
import io.github.jwdeveloper.tiktok.messages.WebcastChatMessage;
import io.github.jwdeveloper.tiktok.messages.WebcastRoomPinMessage;
import lombok.Value;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastChatMessage;
import lombok.Getter;
import java.util.ArrayList;
import java.util.List;
/**
* Triggered every time a new chat comment arrives.
*/
@Value
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokCommentEvent extends TikTokHeaderEvent {
User user;
String text;
String language;
List<User> mentionedUsers;
List<Picture> pictures;
public TikTokCommentEvent(WebcastRoomPinMessage.RoomPinMessageData data) {
super(data.getDetails().getRoomId(), data.getDetails().getMessageId(), data.getDetails().getServerTime());
user = User.MapOrEmpty(data.getSender());
text = data.getComment();
language = data.getLanguage();
mentionedUsers = new ArrayList<>();
pictures = new ArrayList<>();
}
private final User user;
private final String text;
private final String language;
private final List<User> mentionedUsers;
private final List<Picture> pictures;
public TikTokCommentEvent(WebcastChatMessage msg) {
super(msg.getCommon());
user = User.MapOrEmpty(msg.getUser());
user = User.mapOrEmpty(msg.getUser());
text = msg.getContent();
language = msg.getContentLanguage();
mentionedUsers = List.of(User.MapOrEmpty(msg.getAtUser()));
pictures = msg.getEmotesListList().stream().map(e ->Picture.Map(e.getEmote().getImage())).toList();
mentionedUsers = List.of(User.mapOrEmpty(msg.getAtUser()));
pictures = msg.getEmotesListList().stream().map(e -> Picture.Map(e.getEmote().getImage())).toList();
}
}

View File

@@ -25,24 +25,19 @@ package io.github.jwdeveloper.tiktok.events.messages;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.messages.WebcastMsgDetectMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastMsgDetectMessage;
import lombok.Getter;
import java.util.List;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokDetectEvent extends TikTokHeaderEvent {
String language;
List<Number> data;
List<Number> timings;
public TikTokDetectEvent(WebcastMsgDetectMessage msg) {
super(msg.getHeader());;
language = msg.getLanguage();
data = List.of(msg.getData2().getData1(), msg.getData2().getData2(), msg.getData2().getData3());
timings= List.of(msg.getTimestamps().getTimestamp1(), msg.getTimestamps().getTimestamp2(), msg.getTimestamps().getTimestamp3());
super(msg.getCommon());
language = msg.getFromRegion();
}
}

View File

@@ -25,11 +25,13 @@ package io.github.jwdeveloper.tiktok.events.messages;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.events.objects.Picture;
import io.github.jwdeveloper.tiktok.events.objects.Emote;
import io.github.jwdeveloper.tiktok.events.objects.User;
import io.github.jwdeveloper.tiktok.messages.WebcastEmoteChatMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastEmoteChatMessage;
import lombok.Value;
import java.util.List;
/**
* Triggered every time a subscriber sends an emote (sticker).
*/
@@ -37,13 +39,11 @@ import lombok.Value;
@EventMeta(eventType = EventType.Message)
public class TikTokEmoteEvent extends TikTokHeaderEvent {
User user;
String emoteId;
Picture picture;
List<Emote> emotes;
public TikTokEmoteEvent(WebcastEmoteChatMessage msg) {
super(msg.getHeader());
user = User.MapOrEmpty(msg.getSender());
emoteId = msg.getDetails().getId();
picture = new Picture(msg.getDetails().getImage().getUrl());
super(msg.getCommon());
user = User.mapOrEmpty(msg.getUser());
emotes = msg.getEmoteListList().stream().map(Emote::map).toList();
}
}

View File

@@ -24,11 +24,9 @@ package io.github.jwdeveloper.tiktok.events.messages;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.TikTokEvent;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.events.objects.User;
import io.github.jwdeveloper.tiktok.messages.WebcastEnvelopeMessage;
import lombok.Getter;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastEnvelopeMessage;
import lombok.Value;
@@ -40,7 +38,7 @@ import lombok.Value;
public class TikTokEnvelopeEvent extends TikTokHeaderEvent {
User user;
public TikTokEnvelopeEvent(WebcastEnvelopeMessage msg) {
super(msg.getHeader());
user = new User(msg.getUser().getId(), msg.getUser().getUsername());
super(msg.getCommon());
user = User.map(msg.getEnvelopeInfo());
}
}

View File

@@ -26,7 +26,7 @@ import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.events.objects.User;
import io.github.jwdeveloper.tiktok.messages.WebcastSocialMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastSocialMessage;
import lombok.Value;
/**
@@ -36,12 +36,12 @@ import lombok.Value;
@EventMeta(eventType = EventType.Custom)
public class TikTokFollowEvent extends TikTokHeaderEvent
{
User newFollower;
User user;
Long totalFollowers;
public TikTokFollowEvent(WebcastSocialMessage msg) {
super(msg.getHeader());
newFollower = User.MapOrEmpty(msg.getSender());
totalFollowers = msg.getTotalFollowers();
super(msg.getCommon());
user = User.mapOrEmpty(msg.getUser());
totalFollowers = msg.getFollowCount();
}
}

View File

@@ -25,7 +25,8 @@ package io.github.jwdeveloper.tiktok.events.messages;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.objects.Gift;
import io.github.jwdeveloper.tiktok.messages.WebcastGiftMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastGiftMessage;
import lombok.Getter;
@EventMeta(eventType = EventType.Custom)

View File

@@ -28,7 +28,7 @@ import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.events.objects.Gift;
import io.github.jwdeveloper.tiktok.events.objects.User;
import io.github.jwdeveloper.tiktok.messages.WebcastGiftMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastGiftMessage;
import lombok.Getter;
@@ -43,14 +43,14 @@ public class TikTokGiftEvent extends TikTokHeaderEvent {
private final String purchaseId;
private final String receipt;
private final Long comboCount;
private final Boolean comboFinished;
private final boolean comboFinished;
private final Long comboIndex;
public TikTokGiftEvent(Gift gift, WebcastGiftMessage msg) {
super(msg.getCommon());
this.gift = gift;
sender = User.MapOrEmpty(msg.getUser());
purchaseId = msg.getLogId();
sender = User.mapOrEmpty(msg.getUser());
purchaseId = msg.getOrderId();
receipt = msg.getMonitorExtra();
comboCount = msg.getComboCount();
comboFinished = msg.getRepeatEnd() > 0;

View File

@@ -27,7 +27,8 @@ import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.events.objects.Picture;
import io.github.jwdeveloper.tiktok.events.objects.User;
import io.github.jwdeveloper.tiktok.messages.WebcastGoalUpdateMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastGoalUpdateMessage;
import lombok.Getter;
import java.util.List;
@@ -37,16 +38,18 @@ import java.util.List;
public class TikTokGoalUpdateEvent extends TikTokHeaderEvent {
private final Long goalId;
private final Picture picture;
private final String eventType;
private final String label;
private final String description;
private final List<User> users;
public TikTokGoalUpdateEvent(WebcastGoalUpdateMessage msg) {
super(msg.getHeader());
picture = Picture.Map(msg.getImage());
goalId = msg.getId();
eventType = msg.getData().getType();
label = msg.getUpdateData().getLabel();
users = msg.getUpdateData().getUsersList().stream().map(u -> new User(u.getId(), u.getNickname(), Picture.Map(u.getProfileImage()))).toList();
super(msg.getCommon());
picture = Picture.Map(msg.getContributorAvatar());
goalId = msg.getGoal().getId();
description = msg.getGoal().getDescription();
users = msg.getGoal()
.getContributorsListList()
.stream()
.map(u -> new User(u.getUserId(), u.getDisplayId(), Picture.Map(u.getAvatar())))
.toList();
}
}

View File

@@ -24,18 +24,15 @@ package io.github.jwdeveloper.tiktok.events.messages;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.TikTokEvent;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.messages.WebcastImDeleteMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastImDeleteMessage;
import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokIMDeleteEvent extends TikTokHeaderEvent {
private final byte[] data;
public TikTokIMDeleteEvent(WebcastImDeleteMessage msg) {
super(msg.getHeader());
data = msg.getData().toByteArray();
}
}

View File

@@ -24,18 +24,17 @@ package io.github.jwdeveloper.tiktok.events.messages;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.TikTokEvent;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.messages.WebcastInRoomBannerMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastInRoomBannerMessage;
import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokInRoomBannerEvent extends TikTokHeaderEvent {
private final String jSON;
private final String json;
public TikTokInRoomBannerEvent(WebcastInRoomBannerMessage msg) {
super(msg.getHeader());;
jSON = msg.getJson();
super(msg.getHeader());
json = msg.getJson();
}
}

View File

@@ -26,31 +26,25 @@ import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.events.objects.User;
import io.github.jwdeveloper.tiktok.messages.WebcastMemberMessage;
import io.github.jwdeveloper.tiktok.messages.WebcastSocialMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastMemberMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastSocialMessage;
import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Custom)
public class TikTokJoinEvent extends TikTokHeaderEvent {
private User user;
private final Long totalViewers;
private final User user;
private final int viewersCount;
public TikTokJoinEvent(WebcastSocialMessage msg) {
super(msg.getHeader());
if (msg.hasSender()) {
user = new User(msg.getSender());
}
totalViewers = 0L;
public TikTokJoinEvent(WebcastSocialMessage msg, int viewersCount) {
super(msg.getCommon());
user = User.mapOrEmpty(msg.getUser());
this.viewersCount = viewersCount;
}
public TikTokJoinEvent(WebcastMemberMessage msg) {
super(msg.getHeader());
if (msg.hasUser()) {
user = new User(msg.getUser());
}
totalViewers = msg.getTotalViewers();
super(msg.getCommon());
user = User.mapOrEmpty(msg.getUser());
viewersCount = msg.getMemberCount();
}
}

View File

@@ -26,8 +26,8 @@ import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.events.objects.User;
import io.github.jwdeveloper.tiktok.messages.WebcastLikeMessage;
import io.github.jwdeveloper.tiktok.messages.WebcastSocialMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLikeMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastSocialMessage;
import lombok.Getter;
@@ -38,29 +38,23 @@ import lombok.Getter;
@EventMeta(eventType = EventType.Custom)
public class TikTokLikeEvent extends TikTokHeaderEvent
{
private User sender;
private final User user;
private final Integer count;
private final Long totalLikes;
private final Integer totalLikes;
public TikTokLikeEvent(WebcastSocialMessage msg) {
super(msg.getHeader());
if (msg.hasSender()) {
sender = new User(msg.getSender());
}
public TikTokLikeEvent(WebcastSocialMessage msg, int totalLikes) {
super(msg.getCommon());
user = User.mapOrEmpty(msg.getUser());
count = 1;
totalLikes = 0L;
this.totalLikes = totalLikes;
}
public TikTokLikeEvent(WebcastLikeMessage msg) {
super(msg.getHeader());
if (msg.hasSender()) {
sender = new User(msg.getSender());
}
super(msg.getCommon());
user = User.mapOrEmpty(msg.getUser());
count = msg.getCount();
totalLikes = msg.getTotalLikes();
totalLikes = msg.getTotal();
}
}

View File

@@ -26,7 +26,7 @@ import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.events.objects.User;
import io.github.jwdeveloper.tiktok.messages.WebcastLinkMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage;
import lombok.Getter;
import java.util.List;
@@ -41,7 +41,7 @@ public class TikTokLinkEvent extends TikTokHeaderEvent {
private final List<User> otherUsers;
public TikTokLinkEvent(WebcastLinkMessage msg) {
super(msg.getHeader());
super(msg.getCommon());
token = msg.getToken();
if (msg.getUser().getUser().hasUser()) {
user = new User(msg.getUser().getUser().getUser());

View File

@@ -25,28 +25,20 @@ package io.github.jwdeveloper.tiktok.events.messages;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.messages.WebcastLinkLayerMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkLayerMessage;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokLinkLayerEvent extends TikTokHeaderEvent {
private final Long linkId;
private final LinkData link1;
private final LinkData link2;
public TikTokLinkLayerEvent(WebcastLinkLayerMessage msg) {
super(msg.getHeader());
linkId = msg.getId();
link1 = new LinkData(msg.getIdContainer1().getIds().getId1(), msg.getIdContainer1().getIds().getId2());
link2 = new LinkData(msg.getIdContainer2().getIds().getId1(), msg.getIdContainer2().getIds().getId2());
super(msg.getCommon());
}
@AllArgsConstructor
@Getter
private class LinkData {
private final Long id1;
private final Long id2;
}
}

View File

@@ -24,11 +24,10 @@ package io.github.jwdeveloper.tiktok.events.messages;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.TikTokEvent;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.events.objects.LinkMicArmy;
import io.github.jwdeveloper.tiktok.events.objects.Picture;
import io.github.jwdeveloper.tiktok.messages.WebcastLinkMicArmies;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMicArmies;
import lombok.Getter;
import java.util.List;
@@ -49,7 +48,7 @@ public class TikTokLinkMicArmiesEvent extends TikTokHeaderEvent {
private final List<LinkMicArmy> armies;
public TikTokLinkMicArmiesEvent(WebcastLinkMicArmies msg) {
super(msg.getHeader());
super(msg.getCommon());
battleId = msg.getId();
armies = msg.getBattleItemsList().stream().map(LinkMicArmy::new).toList();
picture = Picture.Map(msg.getImage());

View File

@@ -24,10 +24,9 @@ package io.github.jwdeveloper.tiktok.events.messages;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.TikTokEvent;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.events.objects.LinkMicBattleTeam;
import io.github.jwdeveloper.tiktok.messages.WebcastLinkMicBattle;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMicBattle;
import lombok.Getter;
import java.util.List;
@@ -43,7 +42,7 @@ public class TikTokLinkMicBattleEvent extends TikTokHeaderEvent {
private final List<LinkMicBattleTeam> team2;
public TikTokLinkMicBattleEvent(WebcastLinkMicBattle msg) {
super(msg.getHeader());
super(msg.getCommon());
battleId = msg.getId();
team1 = msg.getTeams1List().stream().map(LinkMicBattleTeam::new).toList();
team2 = msg.getTeams2List().stream().map(LinkMicBattleTeam::new).toList();

View File

@@ -24,22 +24,16 @@ package io.github.jwdeveloper.tiktok.events.messages;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.TikTokEvent;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.messages.WebcastLinkMicFanTicketMethod;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMicFanTicketMethod;
import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokLinkMicFanTicketEvent extends TikTokHeaderEvent {
private final Long id;
private final Integer data1;
private final Integer data2;
public TikTokLinkMicFanTicketEvent(WebcastLinkMicFanTicketMethod msg) {
super(msg.getHeader());
id = msg.getData().getDetails().getId();
data1 = msg.getData().getData1();
data2 = msg.getData().getDetails().getData();
super(msg.getCommon());
}
}

View File

@@ -24,24 +24,18 @@ package io.github.jwdeveloper.tiktok.events.messages;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.TikTokEvent;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.messages.LinkMicMethod;
import io.github.jwdeveloper.tiktok.messages.WebcastLinkMicMethod;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMicMethod;
import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokLinkMicMethodEvent extends TikTokHeaderEvent {
private final String jSON;
public TikTokLinkMicMethodEvent(WebcastLinkMicMethod msg) {
super(msg.getHeader());;
jSON = "";
super(msg.getCommon());
}
public TikTokLinkMicMethodEvent(LinkMicMethod msg) {
super(msg.getHeader());;
jSON = msg.getJson();
}
}

View File

@@ -26,7 +26,7 @@ import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.events.objects.User;
import io.github.jwdeveloper.tiktok.messages.WebcastQuestionNewMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastQuestionNewMessage;
import lombok.Getter;
/*
@@ -45,7 +45,7 @@ public class TikTokQuestionEvent extends TikTokHeaderEvent {
public TikTokQuestionEvent(WebcastQuestionNewMessage msg) {
super(msg.getHeader());
super(msg.getCommon());
var data = msg.getDetails();
questionId = data.getId();
text = data.getText();

View File

@@ -24,9 +24,9 @@ package io.github.jwdeveloper.tiktok.events.messages;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.TikTokEvent;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.messages.WebcastRankTextMessage;
import io.github.jwdeveloper.tiktok.events.objects.Text;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastRankTextMessage;
import lombok.Getter;
@Getter
@@ -36,11 +36,11 @@ public class TikTokRankTextEvent extends TikTokHeaderEvent {
private final String label;
public TikTokRankTextEvent(WebcastRankTextMessage msg) {
super(0,0,0);//TODO passing info
eventType = msg.getDetails().getType();
label =msg.getDetails().getLabel();
super(msg.getCommon());
var text = Text.map(msg.getSelfGetBadgeMsg());
label = text.getPattern();
eventType = text.getKey();
}
}

View File

@@ -24,53 +24,22 @@ package io.github.jwdeveloper.tiktok.events.messages;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.TikTokEvent;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.messages.WebcastHourlyRankMessage;
import io.github.jwdeveloper.tiktok.messages.WebcastRankUpdateMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastHourlyRankMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastRankUpdateMessage;
import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokRankUpdateEvent extends TikTokHeaderEvent {
private final String eventType;
private final String label;
private final String rank;
private final String color;
public TikTokRankUpdateEvent(WebcastHourlyRankMessage msg) {
super(msg.getHeader());
var rankData = msg.getData().getRankings();
eventType = rankData.getType();
label = rankData.getLabel();
if(rankData.getDetailsList().isEmpty())
{
rank = "";
}
else
{
rank = rankData.getDetails(0).getLabel();
}
color = rankData.getColor().getColor();
super(msg.getCommon());
}
public TikTokRankUpdateEvent(WebcastRankUpdateMessage msg) {
super(msg.getHeader());
var rankData = msg.getData().getRankData();
eventType = rankData.getType();
label = rankData.getLabel();
if(rankData.getDetailsList().isEmpty())
{
rank = "";
}
else
{
rank = rankData.getDetails(0).getLabel();
}
color = rankData.getColor().getColor();
super(msg.getCommon());
}
}

View File

@@ -26,10 +26,9 @@ import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.events.objects.User;
import io.github.jwdeveloper.tiktok.messages.RoomMessage;
import io.github.jwdeveloper.tiktok.messages.SystemMessage;
import io.github.jwdeveloper.tiktok.messages.WebcastLiveIntroMessage;
import io.github.jwdeveloper.tiktok.messages.WebcastRoomMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLiveIntroMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastRoomMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastSystemMessage;
import lombok.Getter;
@Getter
@@ -40,26 +39,19 @@ public class TikTokRoomEvent extends TikTokHeaderEvent {
private final String message;
public TikTokRoomEvent(WebcastRoomMessage msg) {
super(msg.getHeader());
message = msg.getData();
super(msg.getCommon());
message = msg.getContent();
}
public TikTokRoomEvent(SystemMessage msg) {
super(msg.getHeader());
message = msg.getMessage();
}
public TikTokRoomEvent(RoomMessage msg) {
super(msg.getHeader());
public TikTokRoomEvent(WebcastSystemMessage msg) {
super(msg.getCommon());
message = msg.getMessage();
}
public TikTokRoomEvent(WebcastLiveIntroMessage msg) {
super(msg.getHeader());
if (msg.hasHost()) {
host = new User(msg.getHost());
}
message = msg.getDescription();
super(msg.getCommon());
host = User.mapOrEmpty(msg.getHost());
message = msg.getContent();
hostLanguage = msg.getLanguage();
}

View File

@@ -25,19 +25,22 @@ package io.github.jwdeveloper.tiktok.events.messages;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.messages.WebcastRoomPinMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastRoomPinMessage;
import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokRoomPinEvent extends TikTokHeaderEvent {
private final Long pinTimeStamp;
private final TikTokCommentEvent comment;
public class TikTokRoomPinEvent extends TikTokHeaderEvent
{
public TikTokRoomPinEvent(WebcastRoomPinMessage msg) {
super(msg.getHeader());
this.pinTimeStamp = msg.getTimestamp();
this.comment = new TikTokCommentEvent(msg.getPinData1());
private TikTokCommentEvent pinnedMessage;
private long timestamp;
public TikTokRoomPinEvent(WebcastRoomPinMessage msg, TikTokCommentEvent commentEvent)
{
super(msg.getCommon());
this.timestamp = msg.getTimestamp();
this.pinnedMessage = commentEvent;
}
}

View File

@@ -24,10 +24,9 @@ package io.github.jwdeveloper.tiktok.events.messages;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.TikTokEvent;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.events.objects.TopViewer;
import io.github.jwdeveloper.tiktok.messages.WebcastRoomUserSeqMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastRoomUserSeqMessage;
import lombok.Getter;
import java.util.List;
@@ -35,15 +34,14 @@ import java.util.List;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokRoomViewerDataEvent extends TikTokHeaderEvent {
private final Integer viewerCount;
private final List<TopViewer> topViewers;
private final Integer viewerCount;
private final List<TopViewer> topViewers;
public TikTokRoomViewerDataEvent(WebcastRoomUserSeqMessage msg) {
super(msg.getHeader());
//TODO sorting by rank TopViewers = msg?.TopViewers?.Select(t => new Objects.TopViewer(t))?.OrderBy(t => t.Rank)?
viewerCount = msg.getViewerCount();
topViewers = msg.getTopViewersList().stream().map(TopViewer::new).toList();
}
public TikTokRoomViewerDataEvent(WebcastRoomUserSeqMessage msg) {
super(msg.getCommon());
//TODO sorting by rank TopViewers = msg?.TopViewers?.Select(t => new Objects.TopViewer(t))?.OrderBy(t => t.Rank)?
viewerCount = (int) msg.getTotalUser();
topViewers = msg.getRanksListList().stream().map(TopViewer::new).toList();
}
}

View File

@@ -24,10 +24,9 @@ package io.github.jwdeveloper.tiktok.events.messages;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.TikTokEvent;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.events.objects.User;
import io.github.jwdeveloper.tiktok.messages.WebcastSocialMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastSocialMessage;
import lombok.Getter;
/**
@@ -40,14 +39,14 @@ public class TikTokShareEvent extends TikTokHeaderEvent {
private final Integer amount;
public TikTokShareEvent(WebcastSocialMessage msg, Integer amount) {
super(msg.getHeader());;
user = User.MapOrEmpty(msg.getSender());
super(msg.getCommon());
user = User.mapOrEmpty(msg.getUser());
this.amount = amount;
}
public TikTokShareEvent(WebcastSocialMessage msg) {
super(msg.getHeader());
user = User.MapOrEmpty(msg.getSender());
super(msg.getCommon());
user = User.mapOrEmpty(msg.getUser());
amount = 1;
}

View File

@@ -26,7 +26,7 @@ import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.events.objects.Picture;
import io.github.jwdeveloper.tiktok.messages.WebcastOecLiveShoppingMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastOecLiveShoppingMessage;
import lombok.Getter;
@Getter
@@ -43,7 +43,7 @@ public class TikTokShopEvent extends TikTokHeaderEvent {
private final String shopName;
public TikTokShopEvent(WebcastOecLiveShoppingMessage msg) {
super(msg.getHeader());
super(msg.getCommon());
var data = msg.getShopData();
title = data.getTitle();
price = data.getPriceString();

View File

@@ -24,24 +24,19 @@ package io.github.jwdeveloper.tiktok.events.messages;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.TikTokEvent;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.events.objects.User;
import io.github.jwdeveloper.tiktok.messages.WebcastSubNotifyMessage;
import lombok.Getter;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastSubNotifyMessage;
import lombok.Value;
@Getter
@Value
@EventMeta(eventType = EventType.Message)
public class TikTokSubNotifyEvent extends TikTokHeaderEvent {
private User user;
User user;
public TikTokSubNotifyEvent(WebcastSubNotifyMessage msg) {
super(msg.getHeader());
if (msg.hasSender()) {
user = new User(msg.getSender());
}
super(msg.getCommon());
user = User.mapOrEmpty(msg.getUser());
}
}

View File

@@ -24,10 +24,9 @@ package io.github.jwdeveloper.tiktok.events.messages;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.TikTokEvent;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.events.objects.User;
import io.github.jwdeveloper.tiktok.messages.WebcastMemberMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastMemberMessage;
import lombok.Getter;
/**
@@ -39,7 +38,7 @@ public class TikTokSubscribeEvent extends TikTokHeaderEvent {
private User newSubscriber;
public TikTokSubscribeEvent(WebcastMemberMessage msg) {
super(msg.getHeader());
super(msg.getCommon());
if(msg.hasUser())
{

View File

@@ -24,36 +24,18 @@ package io.github.jwdeveloper.tiktok.events.messages;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.TikTokEvent;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.messages.WebcastUnauthorizedMemberMessage;
import lombok.AllArgsConstructor;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastUnauthorizedMemberMessage;
import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokUnauthorizedMemberEvent extends TikTokHeaderEvent {
private final String data;
private final UnauthorizedMemberData event;
private final UnauthorizedMemberData underlying;
private final String userNickName;
public TikTokUnauthorizedMemberEvent(WebcastUnauthorizedMemberMessage msg) {
super(msg.getHeader());
super(msg.getCommon());
data = msg.getData2();
event = new UnauthorizedMemberData(msg.getDetails1().getType(), msg.getDetails1().getLabel());
underlying = new UnauthorizedMemberData(msg.getDetails2().getType(), msg.getDetails2().getLabel());
userNickName = msg.getNickName();
}
@Getter
@AllArgsConstructor
public class UnauthorizedMemberData {
private final String data1;
private final String data2;
}
}

View File

@@ -24,10 +24,8 @@ package io.github.jwdeveloper.tiktok.events.messages;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.TikTokEvent;
import io.github.jwdeveloper.tiktok.events.base.TikTokUnhandledEvent;
import io.github.jwdeveloper.tiktok.messages.WebcastControlMessage;
import lombok.AllArgsConstructor;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastControlMessage;
import lombok.Getter;
@Getter

View File

@@ -24,10 +24,8 @@ package io.github.jwdeveloper.tiktok.events.messages;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.TikTokEvent;
import io.github.jwdeveloper.tiktok.events.base.TikTokUnhandledEvent;
import io.github.jwdeveloper.tiktok.messages.WebcastMemberMessage;
import lombok.AllArgsConstructor;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastMemberMessage;
import lombok.Getter;
@Getter

View File

@@ -24,11 +24,8 @@ package io.github.jwdeveloper.tiktok.events.messages;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.TikTokEvent;
import io.github.jwdeveloper.tiktok.events.base.TikTokUnhandledEvent;
import io.github.jwdeveloper.tiktok.messages.WebcastMemberMessage;
import io.github.jwdeveloper.tiktok.messages.WebcastSocialMessage;
import lombok.AllArgsConstructor;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastSocialMessage;
import lombok.Getter;
@Getter

View File

@@ -24,13 +24,14 @@ package io.github.jwdeveloper.tiktok.events.messages;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.TikTokEvent;
import io.github.jwdeveloper.tiktok.events.base.TikTokUnhandledEvent;
import io.github.jwdeveloper.tiktok.messages.WebcastResponse;
import lombok.AllArgsConstructor;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastResponse;
import lombok.Getter;
/**
* Triggered every time a protobuf encoded webcast message arrives. You can deserialize the binary object depending on the use case.
*/
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokUnhandledWebsocketMessageEvent extends TikTokUnhandledEvent<WebcastResponse.Message>

View File

@@ -25,7 +25,7 @@ package io.github.jwdeveloper.tiktok.events.messages;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.TikTokEvent;
import io.github.jwdeveloper.tiktok.messages.WebcastResponse;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastResponse;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;

View File

@@ -0,0 +1,46 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.events.messages.poll;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.objects.PollOption;
import io.github.jwdeveloper.tiktok.events.objects.User;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastPollMessage;
import lombok.Getter;
import java.util.List;
@EventMeta(eventType = EventType.Custom)
@Getter
public class TikTokPollEndEvent extends TikTokPollEvent
{
private final User operator;
private final List<PollOption> options;
public TikTokPollEndEvent(WebcastPollMessage msg) {
super(msg);
var end = msg.getEndContent();
operator = User.mapOrEmpty(end.getOperator());
options = end.getOptionListList().stream().map(PollOption::map).toList();
}
}

View File

@@ -20,25 +20,22 @@
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.events.objects;
package io.github.jwdeveloper.tiktok.events.messages.poll;
import io.github.jwdeveloper.tiktok.messages.WebcastGiftMessage;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastPollMessage;
import lombok.Getter;
import lombok.Setter;
@Getter
public class TikTokGift {
private final Gift gift;
private final User sender;
@Setter
private long amount;
@Setter
private boolean streakFinished;
@EventMeta(eventType = EventType.Message)
public class TikTokPollEvent extends TikTokHeaderEvent {
private final Long pollId;
public TikTokGift(Gift gift, WebcastGiftMessage message) {
this.gift = gift;
sender = User.MapOrEmpty(message.getUser());
amount = message.getComboCount();
streakFinished = message.getRepeatEnd() > 0;
public TikTokPollEvent(WebcastPollMessage msg)
{
super(msg.getCommon());
pollId = msg.getPollId();
}
}

View File

@@ -20,34 +20,31 @@
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.events.messages;
package io.github.jwdeveloper.tiktok.events.messages.poll;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.events.objects.PollOption;
import io.github.jwdeveloper.tiktok.events.objects.User;
import io.github.jwdeveloper.tiktok.messages.WebcastPollMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastPollMessage;
import lombok.Getter;
import java.util.List;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokPollEvent extends TikTokHeaderEvent {
private final Long id;
@EventMeta(eventType = EventType.Custom)
public class TikTokPollStartEvent extends TikTokPollEvent {
private final PollOption option1;
private final List<PollOption> options;
private final String title;
private final User operator;
private final PollOption option2;
public TikTokPollStartEvent(WebcastPollMessage msg) {
super(msg);
var startContent = msg.getStartContent();
private final List<PollOption.Option> options;
public TikTokPollEvent(WebcastPollMessage msg) {
super(msg.getHeader());
id = msg.getId();
options = msg.getPollData().getOptionsList().stream().map(e -> new PollOption.Option(e.getLabel(), e.getCurrentTotal())).toList();
option1 = new PollOption(new User(msg.getOptions1().getUser()), msg.getOptions1().getOptionsList().stream().map(e -> new PollOption.Option(e.getLabel(), e.getCurrentTotal())).toList());
option2 = new PollOption(new User(msg.getOptions2().getUser()), msg.getOptions2().getOptionsList().stream().map(e -> new PollOption.Option(e.getLabel(), e.getCurrentTotal())).toList());
title = startContent.getTitle();
operator = User.mapOrEmpty(startContent.getOperator());
options = startContent.getOptionListList().stream().map(PollOption::map).toList();
}
}

View File

@@ -20,20 +20,23 @@
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.models.gifts;
package io.github.jwdeveloper.tiktok.events.messages.poll;
import lombok.Data;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.events.objects.PollOption;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastPollMessage;
import lombok.Getter;
import java.util.List;
@Data
public class Image {
private String avg_color;
private int height;
private int image_type;
private boolean is_animated;
private String open_web_url;
private String uri;
private List<String> url_list;
private int width;
@EventMeta(eventType = EventType.Custom)
@Getter
public class TikTokPollUpdateEvent extends TikTokPollEvent {
private final List<PollOption> options;
public TikTokPollUpdateEvent(WebcastPollMessage msg) {
super(msg);
options = msg.getUpdateContent().getOptionListList().stream().map(PollOption::map).toList();
}
}

View File

@@ -22,7 +22,7 @@
*/
package io.github.jwdeveloper.tiktok.events.objects;
import io.github.jwdeveloper.tiktok.messages.BadgeStruct;
import io.github.jwdeveloper.tiktok.messages.data.BadgeStruct;
import lombok.Value;
import java.util.ArrayList;
@@ -40,7 +40,7 @@ public class Badge {
this.imageBadges = imageBadges;
}
public Badge(io.github.jwdeveloper.tiktok.messages.BadgeStruct badge)
public Badge(io.github.jwdeveloper.tiktok.messages.data.BadgeStruct badge)
{
comboBadges = ComboBadge.map(badge.getCombine());
textBadges = TextBadge.mapAll(badge.getTextList());

View File

@@ -41,6 +41,9 @@ public class BarrageData {
this.users = users;
}
@Value
public static class BarrageUser
{

View File

@@ -20,28 +20,20 @@
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.models.gifts;
package io.github.jwdeveloper.tiktok.events.objects;
import lombok.Data;
import lombok.Value;
import java.util.List;
import java.util.UUID;
@Value
public class Emote {
String emoteId;
Picture picture;
UUID uuid;
public static Emote map(io.github.jwdeveloper.tiktok.messages.data.Emote input) {
return new Emote(input.getEmoteId(), Picture.Map(input.getImage()), UUID.fromString(input.getUuid()));
}
@Data
public class LeftIcon {
private String avg_color;
private int height;
private int image_type;
private boolean is_animated;
private String open_web_url;
private String uri;
private List<String> url_list;
private int width;
}

View File

@@ -22,7 +22,7 @@
*/
package io.github.jwdeveloper.tiktok.events.objects;
import io.github.jwdeveloper.tiktok.messages.LinkMicArmiesItems;
import io.github.jwdeveloper.tiktok.messages.data.LinkMicArmiesItems;
import lombok.Value;
import java.util.List;
@@ -36,9 +36,7 @@ public class LinkMicArmy {
armyId = army.getHostUserId();
armies = army.getBattleGroupsList()
.stream()
.map(x -> new Army(x.getUsersList().stream().map(User::MapOrEmpty).toList(), x.getPoints()))
.map(x -> new Army(x.getUsersList().stream().map(User::mapOrEmpty).toList(), x.getPoints()))
.toList();
}

View File

@@ -23,7 +23,7 @@
package io.github.jwdeveloper.tiktok.events.objects;
import io.github.jwdeveloper.tiktok.messages.WebcastLinkMicBattle;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMicBattle;
import lombok.Getter;
import lombok.Value;

View File

@@ -22,38 +22,92 @@
*/
package io.github.jwdeveloper.tiktok.events.objects;
import io.github.jwdeveloper.tiktok.exceptions.TikTokLiveException;
import lombok.Getter;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
@Getter
public class Picture {
private final String link;
private boolean downloaded;
private boolean downloading;
@Getter
private final String link;
public Picture(String link)
{
this.link = link;
downloaded= false;
downloading =false;
}
public static Picture Map(io.github.jwdeveloper.tiktok.messages.Image profilePicture)
{
return new Picture(profilePicture.getUri());
}
private Image image;
public static Picture Empty()
{
return new Picture("");
}
public Picture(String link) {
this.link = link;
}
public static List<Picture> EmptyList()
{
return new ArrayList<Picture>();
}
public static Picture Map(io.github.jwdeveloper.tiktok.messages.data.Image profilePicture) {
var index = profilePicture.getUrlListCount() - 1;
if (index <= 0) {
return new Picture("");
}
var url = profilePicture.getUrlList(index);
return new Picture(url);
}
public boolean isDownloaded() {
return image != null;
}
public Image downloadImage() {
if (isDownloaded()) {
return image;
}
if (link.equalsIgnoreCase("")) {
return null;
}
image = download(link);
return image;
}
public Future<Image> downloadImageAsync() {
var executor = Executors.newSingleThreadExecutor();
var future = executor.submit(this::downloadImage);
executor.shutdown();
return future;
}
private BufferedImage download(String urlString) {
var baos = new ByteArrayOutputStream();
try (var is = new URL(urlString).openStream()) {
var byteChunk = new byte[4096];
int n;
while ((n = is.read(byteChunk)) > 0) {
baos.write(byteChunk, 0, n);
}
} catch (IOException e) {
throw new TikTokLiveException("Unable map downloaded image", e);
}
var bais = new ByteArrayInputStream(baos.toByteArray());
try {
return ImageIO.read(bais);
} catch (IOException e) {
throw new TikTokLiveException("Unable map downloaded image bytes to Image", e);
}
}
public static Picture Empty() {
return new Picture("");
}
public static List<Picture> EmptyList() {
return new ArrayList<Picture>();
}
}

View File

@@ -22,8 +22,7 @@
*/
package io.github.jwdeveloper.tiktok.events.objects;
import lombok.AllArgsConstructor;
import lombok.Getter;
import io.github.jwdeveloper.tiktok.messages.data.PollOptionInfo;
import lombok.Value;
import java.util.List;
@@ -31,13 +30,18 @@ import java.util.List;
@Value
public class PollOption {
private final User user;
private final List<Option> options;
int optionId;
String content;
int votes;
List<User> users;
@Value
public static final class Option {
private final String label;
public static PollOption map(PollOptionInfo pollOptionInfo) {
private final Integer total;
var users = pollOptionInfo.getVoteUserListList().stream().map(User::mapOrEmpty).toList();
return new PollOption(
pollOptionInfo.getOptionIdx(),
pollOptionInfo.getDisplayContent(),
pollOptionInfo.getVotes(),
users);
}
}

View File

@@ -0,0 +1,84 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.events.objects;
import io.github.jwdeveloper.tiktok.exceptions.TikTokLiveException;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.List;
@Getter
public class Text {
String key;
String pattern;
List<TextPiece> textPieces;
public Text(String key, String pattern, List<TextPiece> textPieces) {
this.key = key;
this.pattern = pattern;
this.textPieces = textPieces;
}
public static Text map(io.github.jwdeveloper.tiktok.messages.data.Text input) {
var pieces = input.getPiecesListList().stream().map(Text::mapTextPiece).toList();
return new Text(input.getKey(), input.getDefaultPattern(), pieces);
}
public static TextPiece mapTextPiece(io.github.jwdeveloper.tiktok.messages.data.Text.TextPiece input)
{
return switch (input.getType())
{
case 0 -> {
var user = User.mapOrEmpty(input.getUserValue().getUser());
yield new UserTextPiece(input.getStringValue(), user);
}
case 1 -> new GiftTextPiece(input.getStringValue());
default -> throw new TikTokLiveException("Unknown text piece");
};
}
@Getter
@AllArgsConstructor
public static class TextPiece {
String value;
}
public static class UserTextPiece extends TextPiece {
User user;
public UserTextPiece(String value, User user) {
super(value);
this.user = user;
}
}
public static class GiftTextPiece extends TextPiece {
Gift gift;
public GiftTextPiece(String value) {
super(value);
}
}
}

View File

@@ -31,10 +31,10 @@ public class TopViewer {
Integer coinsGiven;
public TopViewer(io.github.jwdeveloper.tiktok.messages.TopViewer viewer)
public TopViewer(io.github.jwdeveloper.tiktok.messages.webcast.WebcastRoomUserSeqMessage.Contributor viewer)
{
rank = viewer.getRank();
user = User.MapOrEmpty(viewer.getUser());
coinsGiven = viewer.getCoinsGiven();
rank = (int)viewer.getRank();
user = User.mapOrEmpty(viewer.getUser());
coinsGiven = (int)viewer.getScore();
}
}

View File

@@ -22,33 +22,21 @@
*/
package io.github.jwdeveloper.tiktok.events.objects;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastEnvelopeMessage;
import lombok.Getter;
import java.util.ArrayList;
import java.util.List;
@Getter
public class User {
private Long userId;
private String uniqueId;
private final String nickName;
private String description;
private Picture profilePicture;
private Picture picture720;
private Picture picture1080;
private Picture picture;
private long following;
private long followers;
private long followsHost;
private List<Picture> additionalPictures;
private List<Badge> badges;
public User(Long userId,
@@ -56,9 +44,6 @@ public class User {
String nickName,
String description,
Picture profilePicture,
Picture picture720,
Picture picture1080,
List<Picture> additionalPictures,
Integer following,
Integer followers,
Integer followsHost,
@@ -67,10 +52,7 @@ public class User {
this.uniqueId = uniqueId;
this.nickName = nickName;
this.description = description;
this.profilePicture = profilePicture;
this.picture720 = picture720;
this.picture1080 = picture1080;
this.additionalPictures = additionalPictures;
this.picture = profilePicture;
this.following = following;
this.followers = followers;
this.followsHost = followsHost;
@@ -88,42 +70,53 @@ public class User {
Picture picture) {
this.userId = userId;
this.nickName = nickName;
this.profilePicture = picture;
this.picture = picture;
}
public User(io.github.jwdeveloper.tiktok.messages.User user) {
public User(io.github.jwdeveloper.tiktok.messages.data.User user) {
assert user != null;
userId = user.getId();
uniqueId = user.getSpecialId();
nickName = user.getNickname();
description = user.getBioDescription();
profilePicture = Picture.Map(user.getAvatarThumb());
picture720 = Picture.Map(user.getAvatarMedium());
picture1080 = Picture.Map(user.getAvatarLarge());
picture = Picture.Map(user.getAvatarThumb());
following = user.getFollowInfo().getFollowingCount();
followers = user.getFollowInfo().getFollowerCount();
followsHost = user.getFollowInfo().getFollowStatus();
badges = user.getBadgeListList().stream().map(Badge::new).toList();
additionalPictures = new ArrayList<>();
}
public static User MapOrEmpty(io.github.jwdeveloper.tiktok.messages.User user) {
public static User EMPTY = new User(0L,
"",
"",
"",
Picture.Empty(),
0,
0,
0,
Badge.EmptyList());
public static User mapOrEmpty(io.github.jwdeveloper.tiktok.messages.data.User user) {
if (user != null) {
return new User(user);
}
return EMPTY;
}
public static User mapOrEmpty(io.github.jwdeveloper.tiktok.messages.data.VoteUser user) {
return new User(user.getUserId()+"",user.getNickName());
}
public static User map(WebcastEnvelopeMessage.EnvelopeInfo envelopeInfo) {
return new User(0L,
envelopeInfo.getSendUserId(),
envelopeInfo.getSendUserName(),
"",
"",
"",
Picture.Empty(),
Picture.Empty(),
Picture.Empty(),
Picture.EmptyList(),
Picture.Map(envelopeInfo.getSendUserAvatar()),
0,
0,
0,
Badge.EmptyList());
}
}

View File

@@ -20,7 +20,9 @@
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.models.gifts;
package io.github.jwdeveloper.tiktok.events.objects.barrage;
public class BarrageParam
{
public class TrackerParams {
}

View File

@@ -20,12 +20,18 @@
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.models.gifts;
package io.github.jwdeveloper.tiktok.events.objects.barrage;
import lombok.Data;
import io.github.jwdeveloper.tiktok.events.objects.User;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastBarrageMessage;
@Data
public class LockInfo
public class FansLevelParam extends BarrageParam
{
private int lock_type;
int currentGrade;
User user;
public FansLevelParam(WebcastBarrageMessage.BarrageTypeFansLevelParam param)
{
this.currentGrade = param.getCurrentGrade();
this.user = User.mapOrEmpty(param.getUser());
}
}

View File

@@ -20,16 +20,14 @@
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.models;
package io.github.jwdeveloper.tiktok.events.objects.barrage;
import lombok.AllArgsConstructor;
import lombok.Data;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastBarrageMessage;
@Data
@AllArgsConstructor
public class GiftId
public class SubscribeGiftParam extends BarrageParam
{
private long giftId;
public SubscribeGiftParam(WebcastBarrageMessage.BarrageTypeSubscribeGiftParam param)
{
private String userName;
}
}

View File

@@ -20,21 +20,16 @@
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.models.gifts;
package io.github.jwdeveloper.tiktok.events.objects.barrage;
import lombok.Data;
import io.github.jwdeveloper.tiktok.events.objects.User;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastBarrageMessage;
import java.util.List;
@Data
public class Icon {
private String avg_color;
private int height;
private int image_type;
private boolean is_animated;
private String open_web_url;
private String uri;
private List<String> url_list;
private int width;
public class UserGradeParam extends BarrageParam {
int currentGrade;
User user;
public UserGradeParam(WebcastBarrageMessage.BarrageTypeUserGradeParam param) {
this.currentGrade = param.getCurrentGrade();
this.user = User.mapOrEmpty(param.getUser());
}
}

View File

@@ -22,7 +22,8 @@
*/
package io.github.jwdeveloper.tiktok.exceptions;
import io.github.jwdeveloper.tiktok.messages.WebcastResponse;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastResponse;
import lombok.Getter;
import java.util.Base64;
@@ -38,19 +39,19 @@ public class TikTokLiveMessageException extends TikTokLiveException {
public TikTokLiveMessageException(WebcastResponse.Message message,
WebcastResponse webcastResponse,
Throwable cause) {
super("Error while handling Message: " + message.getType() + ": \n", cause);
super("Error while handling Message: " + message.getMethod() + ": \n", cause);
this.webcastMessage = message;
this.webcastResponse = webcastResponse;
}
public String messageName()
public String messageMethod()
{
return webcastMessage.getType();
return webcastMessage.getMethod();
}
public String messageToBase64()
{
return Base64.getEncoder().encodeToString(webcastMessage.getBinary().toByteArray());
return Base64.getEncoder().encodeToString(webcastMessage.getPayload().toByteArray());
}
public String webcastResponseToBase64()

View File

@@ -24,7 +24,7 @@ package io.github.jwdeveloper.tiktok.handler;
import io.github.jwdeveloper.tiktok.events.TikTokEvent;
import io.github.jwdeveloper.tiktok.messages.WebcastResponse;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastResponse;
public interface TikTokMessageHandler

View File

@@ -23,19 +23,12 @@
package io.github.jwdeveloper.tiktok.live;
import io.github.jwdeveloper.tiktok.events.objects.Gift;
import io.github.jwdeveloper.tiktok.events.objects.TikTokGift;
import io.github.jwdeveloper.tiktok.models.GiftId;
import io.github.jwdeveloper.tiktok.events.objects.Picture;
import java.util.List;
import java.util.Map;
public interface GiftManager {
Map<GiftId, TikTokGift> getActiveGifts();
/**
* In case you can't find your gift in Gift enum. You can register gift
* manually here to make it detected while TikTokGiftEvent
@@ -45,7 +38,7 @@ public interface GiftManager {
* @param diamondCost diamond cost
* @return
*/
Gift registerGift(int id, String name, int diamondCost);
Gift registerGift(int id, String name, int diamondCost, Picture picture);
/**

View File

@@ -22,9 +22,12 @@
*/
package io.github.jwdeveloper.tiktok.live;
import io.github.jwdeveloper.tiktok.models.ConnectionState;
public interface LiveRoomInfo
{
int getViewersCount();
int getLikesCount();
boolean isAgeRestricted();
String getRoomId();
String getUserName();

View File

@@ -20,7 +20,7 @@
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.live;
package io.github.jwdeveloper.tiktok.models;
public enum ConnectionState
{

View File

@@ -1,37 +0,0 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.models.gifts;
import lombok.Data;
@Data
public class DefaultFormat {
private boolean bold;
private String color;
private int font_size;
private boolean italic;
private int italic_angle;
private boolean use_highlight_color;
private boolean use_remote_color;
private int weight;
}

View File

@@ -1,35 +0,0 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.models.gifts;
import lombok.Data;
import java.util.List;
@Data
public class DisplayText {
private DefaultFormat default_format;
private String default_pattern;
private String key;
private List<Object> pieces;
}

View File

@@ -1,39 +0,0 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.models.gifts;
import lombok.Data;
import java.util.List;
@Data
public class GiftLabelIcon {
private String avg_color;
private int height;
private int image_type;
private boolean is_animated;
private String open_web_url;
private String uri;
private List<String> url_list;
private int width;
}

View File

@@ -1,36 +0,0 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.models.gifts;
import lombok.Data;
import java.util.List;
@Data
public class GiftPanelBanner {
private List<Object> bg_color_values;
private DisplayText display_text;
private LeftIcon left_icon;
private String schema_url;
}

View File

@@ -1,26 +0,0 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.models.gifts;
public class SpecialEffects {
}

View File

@@ -1,72 +0,0 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.models.gifts;
import lombok.Data;
import java.util.List;
@Data
public class TikTokGiftInfo
{
private int action_type;
private int app_id;
private String business_text;
private boolean can_put_in_gift_box;
private List<Object> color_infos;
private boolean combo;
private String describe;
private int diamond_count;
private int duration;
private String event_name;
private boolean for_custom;
private boolean for_linkmic;
private GiftLabelIcon gift_label_icon;
private GiftPanelBanner gift_panel_banner;
private String gift_rank_recommend_info;
private int gift_scene;
private String gold_effect;
private String gray_scheme_url;
private String guide_url;
private Icon icon;
private int id;
private Image image;
private boolean is_box_gift;
private boolean is_broadcast_gift;
private boolean is_displayed_on_panel;
private boolean is_effect_befview;
private boolean is_gray;
private boolean is_random_gift;
private int item_type;
private LockInfo lock_info;
private String manual;
private String name;
private boolean notify;
private int primary_effect_id;
private String region;
private String scheme_url;
private SpecialEffects special_effects;
private TrackerParams tracker_params;
private List<Object> trigger_words;
private int type;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,117 @@
syntax = "proto3";
package TikTok;
option java_package = "io.github.jwdeveloper.tiktok.messages.enums";
option java_multiple_files = true;
enum AuditStatus {
AUDITSTATUSUNKNOWN = 0;
AUDITSTATUSPASS = 1;
AUDITSTATUSFAILED = 2;
AUDITSTATUSREVIEWING = 3;
AUDITSTATUSFORBIDDEN = 4;
}
enum EmoteType {
EMOTETYPENORMAL = 0;
EMOTETYPEWITHSTICKER = 1;
}
enum ContentSource {
CONTENTSOURCEUNKNOWN = 0;
CONTENTSOURCENORMAL = 1;
CONTENTSOURCECAMERA = 2;
}
enum EmotePrivateType {
EMOTE_PRIVATE_TYPE_NORMAL = 0;
EMOTE_PRIVATE_TYPE_SUB_WAVE = 1;
}
enum ExhibitionType {
EXHIBITIONTYPE_DEFAULT = 0;
EXHIBITIONTYPE_FOLD = 1;
EXHIBITIONTYPE_PUBLICSCREEN = 2;
}
enum SubscribeType {
SUBSCRIBETYPE_ONCE = 0;
SUBSCRIBETYPE_AUTO = 1;
SUBSCRIBETYPE_DEFAULT = 100;
}
enum OldSubscribeStatus {
OLDSUBSCRIBESTATUS_FIRST = 0;
OLDSUBSCRIBESTATUS_RESUB = 1;
OLDSUBSCRIBESTATUS_SUBINGRACEPERIOD = 2;
OLDSUBSCRIBESTATUS_SUBNOTINGRACEPERIOD = 3;
OLDSUBSCRIBESTATUS_DEFAULT = 100;
}
enum SubscribingStatus {
SUBSCRIBINGSTATUS_UNKNOWN = 0;
SUBSCRIBINGSTATUS_ONCE = 1;
SUBSCRIBINGSTATUS_CIRCLE = 2;
SUBSCRIBINGSTATUS_CIRCLECANCEL = 3;
SUBSCRIBINGSTATUS_REFUND = 4;
SUBSCRIBINGSTATUS_INGRACEPERIOD = 5;
SUBSCRIBINGSTATUS_NOTINGRACEPERIOD = 6;
}
enum LinkmicStatus
{
Disable = 0;
Enable = 1;
Just_Following = 2;
Multi_Linking = 3;
Multi_Linking_Only_Following = 4;
}
enum MemberMessageAction {
UNKNOWN = 0;
JOINED = 1; // User Joined the Stream
SUBSCRIBED = 3; // User Subscribed to the Host
//?? = 26
//?? = 27
//?? = 50 (share?)
}
enum ControlAction {
ControlActionUNKNOWN = 0;
STREAM_PAUSED = 1; // Stream Paused by Host
STREAM_ENDED = 3; // Stream Ended by Host
}
enum LinkLayerMessageType
{
Linker_Unknown = 0;
Linker_Create = 1;
Linker_Invite = 2;
Linker_Apply = 3;
Linker_Permit = 4;
Linker_Reply = 5;
Linker_Kick_Out = 6;
Linker_Cancel_Apply = 7;
Linker_Cancel_Invite = 8;
Linker_Leave = 9;
Linker_Finish = 10;
Linker_List_Change = 11;
Linker_Join_Direct = 12;
Linker_Join_Group = 13;
Linker_Permit_Group = 14;
Linker_Cancel_Group = 15;
Linker_Leave_Group = 16;
Linker_P2P_Group_Change = 17;
Linker_Group_Change = 18;
}
enum BarrageType
{
BarrageType_Unknown = 0;
EComOrdering = 1;
EComBuying = 2;
Normal = 3;
Subscribe = 4;
EventView = 5;
EventRegistered = 6;
SubscribeGift = 7;
UserUpgrade = 8;
GradeUserEntranceNotification = 9;
FansLevelUpgrade = 10;
FansLevelEntrance = 11;
GamePartnership = 12;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,719 @@
syntax = "proto3";
package TikTok;
// Instruction if data.proto or enums.proto is not be found!
// https://stackoverflow.com/questions/62837953/protocol-buffer-imports-not-recognized-in-intellij
//
import "data.proto";
import "enums.proto";
option java_package = "io.github.jwdeveloper.tiktok.messages.webcast";
option java_multiple_files = true;
//@WebcastPushFrame
// Response from TikTokServer. Container for Messages
message WebcastPushFrame {
uint64 SeqId = 1;
uint64 LogId = 2;
uint64 Service = 3;
uint64 Method = 4;
map<string,string> headers = 5;
string PayloadEncoding = 6;
string PayloadType = 7;
bytes Payload = 8;
}
message WebcastWebsocketAck {
uint64 Id = 1;
string Type = 2;
}
//@WebcastResponse
// Response from TikTokServer. Container for Messages
message WebcastResponse {
repeated Message messages = 1;
string cursor = 2;
int64 fetchInterval = 3;
int64 now = 4;
string internalExt = 5;
int32 fetchType = 6;
map<string, string> routeParamsMap = 7;
int64 heartBeatDuration = 8;
bool needsAck = 9;
string pushServer = 10;
bool isFirst = 11;
string historyCommentCursor = 12;
bool historyNoMore = 13;
// Server-Message. Binary will deserialize into specific message
message Message {
string method = 1;
bytes payload = 2;
int64 msgId = 3;
int32 msgType = 4;
int64 offset = 5;
bool isHistory = 6;
}
}
//@GiftMessage
message WebcastGiftMessage {
Common common = 1;
int64 giftId = 2;
int64 fanTicketCount = 3;
int64 groupCount = 4;
int64 repeatCount = 5;
int64 comboCount = 6;
User user = 7;
User toUser = 8;
int32 repeatEnd = 9;
int64 groupId = 11;
int64 incomeTaskgifts = 12;
int64 roomFanTicketCount = 13;
GiftStruct gift = 15;
string logId = 16;
int64 sendType = 17;
string monitorExtra = 22;
int64 colorId = 24;
bool isFirstSent = 25;
string orderId = 28;
UserIdentity userIdentity = 32;
message GiftIMPriority {
repeated int64 queueSizesList = 1;
int64 selfQueuePriority = 2;
int64 priority = 3;
}
message PublicAreaCommon {
Image userLabel = 1;
int64 userConsumeInRoom = 2;
}
message UserIdentity {
bool isGiftGiverOfAnchor = 1;
bool isSubscriberOfAnchor = 2;
bool isMutualFollowingWithAnchor = 3;
bool isFollowerOfAnchor = 4;
bool isModeratorOfAnchor = 5;
bool isAnchor = 6;
}
}
//@WebcastRoomMessage
message WebcastRoomMessage {
Common common = 1;
string content = 2;
bool supprotLandscape = 3;
int64 source = 4;
Image icon = 5;
string scene = 6;
bool isWelcome = 7;
}
//@WebcastBarrageMessage
message WebcastBarrageMessage {
Common common = 1;
BarrageEvent event = 2;
BarrageType msgType = 3; // Enum
Image icon = 4;
Text content = 5;
int32 duration = 6;
Image background = 7;
Image rightIcon = 8;
BarrageTypeUserGradeParam userGradeParam = 100;
BarrageTypeFansLevelParam fansLevelParam = 101;
BarrageTypeSubscribeGiftParam subscribeGiftParam = 102;
message BarrageTypeUserGradeParam {
int32 currentGrade = 1;
int32 displayConfig = 2;
string userId = 3;
User user = 4;
}
message BarrageTypeFansLevelParam {
int32 currentGrade = 1;
int32 displayConfig = 2;
User user = 4;
}
message BarrageTypeSubscribeGiftParam {
int64 giftSubCount = 1;
bool showGiftSubCount = 2;
}
message BarrageEvent {
string eventName = 1;
}
// @BarrageType
// webcast.im.BarrageMessage
enum BarrageType {
UNKNOWN = 0;
ECOMORDERING = 1;
ECOMBUYING = 2;
NORMAL = 3;
SUBSCRIBE = 4;
EVENTVIEW = 5;
EVENTREGISTERED = 6;
SUBSCRIBEGIFT = 7;
USERUPGRADE = 8;
GRADEUSERENTRANCENOTIFICATION = 9;
FANSLEVELUPGRADE = 10;
FANSLEVELENTRANCE = 11;
GAMEPARTNERSHIP = 12;
}
}
//@WebcastCaptionMessage
// Closed Captioning for Video
message WebcastCaptionMessage {
Common header = 1;
uint64 timeStamp = 2;
uint32 data1 = 3;
CaptionData captionData = 4;
message CaptionData {
string ISOLanguage = 1;
string Text = 2;
}
}
// Comment sent by User
//@WebcastChatMessage
message WebcastChatMessage {
Common common = 1;
User user = 2;
string content = 3;
bool visibleToSender = 4;
Image backgroundImage = 5;
string fullScreenTextColor = 6;
Image backgroundImageV2 = 7;
Image giftImage = 10;
int32 inputType = 11;
User atUser = 12;
repeated EmoteWithIndex emotesList = 13;
string contentLanguage = 14;
int32 quickChatScene = 16;
int32 communityFlaggedStatus = 17;
// @EmoteWithIndex
// proto.webcast.im.ChatMessage
message EmoteWithIndex {
int64 index = 1;
Emote emote = 2;
}
}
// System-Control Message from Room (e.g. Host ended Stream)
//@WebcastControlMessage
message WebcastControlMessage {
Common common = 1;
ControlAction action = 2;
string tips = 3;
Extra extra = 4;
//PerceptionDialogInfo perceptionDialog = 5;
Text perceptionAudienceText = 6;
PunishEventInfo punishInfo = 7;
Text floatText = 8;
int32 floatStyle = 9;
// @Extra
// proto.webcast.im.ControlMessage
message Extra {
string banInfoUrl = 1;
int64 reasonNo = 2;
Text title = 3;
Text violationReason = 4;
Text content = 5;
Text gotItButton = 6;
Text banDetailButton = 7;
string source = 8;
}
}
// Emote sent by user
//@WebcastEmoteChatMessage
message WebcastEmoteChatMessage {
Common common = 1;
User user = 2;
repeated Emote emoteList = 3;
MsgFilter msgFilter = 4;
UserIdentity userIdentity = 5;
}
//@WebcastEnvelopeMessage
message WebcastEnvelopeMessage {
Common common = 1;
EnvelopeInfo envelopeInfo = 2;
int64 display = 3; // @warning Enum not found, should be Display
// @EnvelopeInfo
// proto.webcast.im.EnvelopeMessage
// C:\Users\ja\RiderProjects\TikTokProBufferGenerator\Application\output\sources\test.js
message EnvelopeInfo {
string envelopeId = 1;
int64 businessType = 2; // @warning Enum not found, should be BusinessType
string envelopeIdc = 3;
string sendUserName = 4;
int32 diamondCount = 5;
int32 peopleCount = 6;
int32 unpackAt = 7;
string sendUserId = 8;
Image sendUserAvatar = 9;
string createAt = 10;
string roomId = 11;
int64 followShowStatus = 12; // @warning Enum not found, should be FollowShowStatus
int32 skinId = 13;
}
}
//@WebcastGoalUpdateMessage
message WebcastGoalUpdateMessage {
Common common = 1;
Indicator indicator = 2;
Goal goal = 3;
int64 contributorId = 4;
Image contributorAvatar = 5;
string contributorDisplayId = 6;
// SubGoal contributeSubgoal = 7;
int64 contributeCount = 9;
int64 contributeScore = 10;
int64 giftRepeatCount = 11;
string contributorIdStr = 12;
bool pin = 13;
bool unpin = 14;
// GoalPinInfo pinInfo = 15;
}
// Message related to Chat-moderation?
//@WebcastImDeleteMessage
message WebcastImDeleteMessage {
Common header = 1;
bytes data = 3;
}
//@WebcastInRoomBannerMessage
message WebcastInRoomBannerMessage {
Common header = 1;
string json = 2; // Json-Data for BannerMessage
}
// User sent one or multiple likes to Stream. Maxes at 15 likes per message
//@WebcastLikeMessage
message WebcastLikeMessage {
Common common = 1;
int32 count = 2;
int32 total = 3;
User user = 5;
}
// Status of Room (ViewerCount + Top Viewers)
//@WebcastRoomUserSeqMessage
message WebcastRoomUserSeqMessage {
Common common = 1;
repeated Contributor ranksList = 2;
int64 total = 3;
string popStr = 4;
repeated Contributor seatsList = 5;
int64 popularity = 6;
int32 totalUser = 7;
int64 anonymous = 8;
// @Contributor
message Contributor {
int32 score = 1;
User user = 2;
int32 rank = 3;
int64 delta = 4;
}
}
// Sent for a variety of events, including Follow & Share
//@WebcastSocialMessage
message WebcastSocialMessage {
Common common = 1;
User user = 2;
int64 shareType = 3;
int64 action = 4;
string shareTarget = 5;
int64 followCount = 6;
int64 shareDisplayStyle = 7;
int64 shareCount = 8;
}
//@WebcastSubNotifyMessage
message WebcastSubNotifyMessage {
Common common = 1;
User user = 2;
ExhibitionType exhibitionType = 3; // Enum
int64 subMonth = 4;
SubscribeType subscribeType = 5; // Enum
OldSubscribeStatus oldSubscribeStatus = 6; // Enum
SubscribingStatus subscribingStatus = 8; // Enum
bool isSend = 9;
bool isCustom = 10;
}
//@WebcastRankUpdateMessage
message WebcastRankUpdateMessage {
Common common = 1;
repeated RankUpdate updatesList = 2;
int64 groupType = 3; // @warning Enum not found, should be GroupType
int64 priority = 5;
repeated RankTabInfo tabsList = 6;
bool isAnimationLoopPlay = 7;
bool animationLoopForOff = 8;
message RankTabInfo {
int64 rankType = 1; // @warning Enum not found, should be RankType
string title = 2;
Text titleText = 3;
int64 listLynxType = 4;
}
// @RankUpdate
// proto.webcast.im.RankUpdateMessage
message RankUpdate {
int64 rankType = 1; // @warning Enum not found, should be RankType
int64 ownerRank = 2;
Text defaultContent = 3;
bool showEntranceAnimation = 5;
int64 countdown = 6;
int64 relatedTabRankType = 8; // @warning Enum not found, should be RelatedTabRankType
int64 requestFirstShowType = 9; // @warning Enum not found, should be RequestFirstShowType
int64 supportedVersion = 10;
bool owneronrank = 11;
}
}
// Sent for a variety of events, including Join & Subscribe
//@WebcastMemberMessage
message WebcastMemberMessage {
Common common = 1;
User user = 2;
int32 memberCount = 3;
User operator = 4;
bool isSetToAdmin = 5;
bool isTopUser = 6;
int64 rankScore = 7;
int64 topUserNo = 8;
int64 enterType = 9;
MemberMessageAction action = 10;
string actionDescription = 11;
int64 userId = 12;
EffectConfig effectConfig = 13;
string popStr = 14;
EffectConfig enterEffectConfig = 15;
Image backgroundImage = 16;
Image backgroundImageV2 = 17;
Text anchorDisplayText = 18;
string clientEnterSource = 19;
string clientEnterType = 20;
string clientLiveReason = 21;
int64 actionDuration = 22;
string userShareType = 23;
// @EffectConfig
// proto.webcast.im.MemberMessage
// C:\Users\ja\RiderProjects\TikTokProBufferGenerator\Application\output\sources\test.js
message EffectConfig {
int64 type = 1;
Image icon = 2;
int64 avatarPos = 3;
Text text = 4;
Image textIcon = 5;
int32 stayTime = 6;
int64 animAssetId = 7;
Image badge = 8;
repeated int64 flexSettingArrayList = 9;
}
}
// --- HandMade --
//@WebcastPollMessage
message WebcastPollMessage {
Common common = 1;
int32 messageType = 2;
int64 pollId = 3;
PollStartContent startContent = 4;
PollEndContent endContent = 5;
PollUpdateVotesContent updateContent = 6;
int32 pollKind = 7; // Possibly an Enum?
}
//@WebcastQuestionNewMessage
message WebcastQuestionNewMessage {
Common common = 1;
QuestionDetails details = 2;
message QuestionDetails {
uint64 id = 1;
string text = 2;
uint64 timeStamp = 4;
User user = 5;
uint32 data1 = 20;
}
}
//@WebcastRankTextMessage
message WebcastRankTextMessage {
Common common = 1;
int32 scene = 2;
int64 ownerIdxBeforeUpdate = 3;
int64 ownerIdxAfterUpdate = 4;
Text selfGetBadgeMsg = 5;
Text otherGetBadgeMsg = 6;
int64 curUserId = 7;
}
//@WebcastHourlyRankMessage
message WebcastHourlyRankMessage {
Common common = 1;
RankContainer data = 2;
uint32 data2 = 3;
message RankContainer {
uint32 data1 = 1;
RankingData rankingdata = 2;
uint32 data2 = 3;
Ranking rankings = 4;
RankingData2 rankingdata2 = 5;
uint32 data3 = 6;
uint32 data4 = 7;
message RankingData {
uint32 data1 = 1;
Ranking rankdata = 2;
string data2 = 3;
}
message RankingData2 {
uint32 data1 = 1;
uint32 data2 = 2;
Ranking rankdata = 3;
string data3 = 4;
uint32 data4 = 5;
uint32 data5 = 6;
}
}
}
//@WebcastLinkMicArmies
message WebcastLinkMicArmies {
Common common = 1;
uint64 id = 2;
repeated LinkMicArmiesItems battleItems = 3;
uint64 id2 = 4;
uint64 timeStamp1 = 5;
uint64 timeStamp2 = 6;
int32 battleStatus = 7; // SHOULD BE AN ENUM
uint64 data1 = 8;
uint64 data2 = 9;
uint32 data3 = 10;
Image Image = 11;
uint32 data4 = 12;
uint32 data5 = 13;
}
//@WebcastLinkMicBattle
message WebcastLinkMicBattle {
Common common = 1;
uint64 id = 2;
LinkMicBattleConfig battleConfig = 3;
uint32 data2 = 4;
repeated LinkMicBattleDetails details = 5;
repeated LinkMicBattleTeam teams1 = 9;
repeated LinkMicBattleTeam teams2 = 10;
repeated LinkMicBattleTeamData teamData = 13;
message LinkMicBattleConfig {
uint64 id1 = 1;
uint64 timestamp = 2;
uint32 data1 = 3;
uint64 id2 = 4;
uint32 data2 = 5;
}
message LinkMicBattleData {
uint64 id = 1;
uint32 data1 = 2;
uint32 data2 = 3;
uint32 data3 = 5;
string url = 6;
}
message LinkMicBattleDetails {
uint64 id = 1;
LinkMicBattleData details = 2;
}
message LinkMicBattleTeam {
uint64 id = 1;
repeated User users = 2;
}
message LinkMicBattleTeamData {
uint64 teamId = 1;
LinkMicBattleData data = 2;
}
}
//@WebcastLinkMicFanTicketMethod
message WebcastLinkMicFanTicketMethod {
Common common = 1;
FanTicketRoomNoticeContent FanTicketRoomNotice = 2;
}
//@WebcastLinkMicMethod
message WebcastLinkMicMethod {
Common common = 1;
int64 messageType = 2;
string accessKey = 3;
int64 anchorLinkmicId = 4;
int64 userId = 5;
int64 fanTicket = 6;
int64 totalLinkMicFanTicket = 7;
int64 channelId = 8;
int64 layout = 9;
int64 vendor = 10;
int64 dimension = 11;
string theme = 12;
int64 inviteUid = 13;
}
//@WebcastLiveIntroMessage
message WebcastLiveIntroMessage {
Common common = 1;
int64 roomId = 2;
AuditStatus auditStatus = 3;
string content = 4;
User host = 5;
int32 introMode = 6;
repeated BadgeStruct badges = 7;
string language = 8;
}
//@WebcastUnauthorizedMemberMessage
message WebcastUnauthorizedMemberMessage {
Common common = 1;
int32 action = 2;
Text nickNamePrefix = 3;
string nickName = 4;
Text enterText = 5;
}
//@WebcastMsgDetectMessage
message WebcastMsgDetectMessage {
Common common = 1;
int32 detectType = 2; // Possibly an Enum?
TriggerCondition triggerCondition = 3;
TimeInfo timeInfo = 4;
int32 triggerBy = 5; // Possible an Enum?
string fromRegion = 6;
message TimeInfo {
int64 clientStartMs = 1;
int64 apiRecvTimeMs = 2;
int64 apiSendToGoimMs = 3;
}
message TriggerCondition {
bool uplinkDetectHttp = 1;
bool uplinkDetectWebSocket = 2;
bool detectP2PMsg = 3;
bool detectRoomMsg = 4;
bool httpOptimize = 5;
}
}
//@WebcastOecLiveShoppingMessage
message WebcastOecLiveShoppingMessage {
Common common = 1;
uint32 data1 = 2;
LiveShoppingData shopData = 4;
TimeStampContainer shopTimings = 5; // Uses index 1, 2 & 3
LiveShoppingDetails details = 9;
message LiveShoppingData {
string title = 1;
string priceString = 2; // $55.99
string imageUrl = 3;
string shopUrl = 4;
uint64 data1 = 6;
string shopName = 7; // "Shopify"
uint64 data2 = 8;
string shopUrl2 = 9;
uint64 data3 = 10;
uint64 data4 = 11;
}
message LiveShoppingDetails {
string id1 = 1;
string data1 = 3;
uint32 data2 = 4;
uint64 timestamp = 5;
ValueLabel data = 6;
}
}
//@WebcastRoomPinMessage
// Host Pins comment to stream
message WebcastRoomPinMessage {
Common common = 1;
bytes pinnedMessage = 2; // Usually this is a ChatMessage, but it can also be another message.
string originalMsgType = 30; // Use this Type/Method to Deserialize the PinnedMessage
uint64 timestamp = 31;
}
//@SystemMessage
message WebcastSystemMessage {
Common common = 1;
string message = 2;
}
//@WebcastLinkMessage
message WebcastLinkMessage {
Common common = 1;
uint32 data1 = 2;
uint64 data2 = 3;
uint32 data3 = 4;
LinkMessageData data = 18;
LinkMessageUserContainer user = 20;
string token = 200;
message LinkMessageData {
DataContainer data = 1; // index 1 is an Id
}
message LinkMessageUserContainer {
LinkMessageUser user = 1;
repeated LinkMessageUser otherUsers = 2;
message LinkMessageUser {
User user = 1;
uint64 timeStamp = 2;
uint32 data1 = 4;
string idString = 5;
uint32 data2 = 7;
}
}
}
//@WebcastLinkLayerMessage
message WebcastLinkLayerMessage {
Common common = 1;
LinkLayerMessageType messageType = 2;
int64 channelId = 3;
}