mirror of
https://github.com/jwdeveloper/TikTokLiveJava.git
synced 2026-02-27 08:49:40 -05:00
Compare commits
109 Commits
1.8.5-Rele
...
develop-1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ffde21afac | ||
|
|
aa1ef1f170 | ||
|
|
834dfa0939 | ||
|
|
ab97affc73 | ||
|
|
c8120d89b2 | ||
|
|
d325dffdac | ||
|
|
dac688e9d6 | ||
|
|
92c9724108 | ||
|
|
f7bef6bb31 | ||
|
|
d8661fa2e3 | ||
|
|
fc02239d48 | ||
|
|
77eeedc15c | ||
|
|
54b0216bf3 | ||
|
|
4443fbe554 | ||
|
|
a6188d8bb0 | ||
|
|
81fd7dc85c | ||
|
|
7e59099793 | ||
|
|
dd2f311539 | ||
|
|
ba69f5f5eb | ||
|
|
e9a91f5741 | ||
|
|
053bb5e3dc | ||
|
|
906796dc23 | ||
|
|
162092c638 | ||
|
|
a72d134796 | ||
|
|
75f6368f2c | ||
|
|
b9eb0eba93 | ||
|
|
50d6d6e515 | ||
|
|
42f9fe360b | ||
|
|
dff226740c | ||
|
|
951d30e6a7 | ||
|
|
1df912b722 | ||
|
|
4aec20cc35 | ||
|
|
d877d38db6 | ||
|
|
db199e9a64 | ||
|
|
1c56cf35f0 | ||
|
|
225cb2df11 | ||
|
|
1cc8a5af1b | ||
|
|
edefd0c1fd | ||
|
|
07a28e2632 | ||
|
|
cc811f6c0a | ||
|
|
735bdfbb10 | ||
|
|
28ef3562b6 | ||
|
|
3b6b381e31 | ||
|
|
86a79d687e | ||
|
|
65a651d4b8 | ||
|
|
8bda5d789c | ||
|
|
81fb2b4576 | ||
|
|
64b2e74d2b | ||
|
|
8a1f3255d0 | ||
|
|
03892390fa | ||
|
|
71602d5513 | ||
|
|
20db7cb773 | ||
|
|
3fda7fe446 | ||
|
|
8fcbb4b20f | ||
|
|
d90ab60e52 | ||
|
|
33f9862758 | ||
|
|
d74c294323 | ||
|
|
31f0e4210d | ||
|
|
2e22da1fbe | ||
|
|
4b4874d33e | ||
|
|
9c7b24f33e | ||
|
|
7476a11ae0 | ||
|
|
125e421ea9 | ||
|
|
5d84e28bdb | ||
|
|
a9003f4296 | ||
|
|
8cd640f8eb | ||
|
|
ca741ed931 | ||
|
|
96872e27b5 | ||
|
|
f6fbd60eca | ||
|
|
437335f784 | ||
|
|
84b0a3aaf4 | ||
|
|
14bf9c8c9b | ||
|
|
2dc3001e7b | ||
|
|
29a81f4cd6 | ||
|
|
70fd174a95 | ||
|
|
3e23e5b939 | ||
|
|
733e72f814 | ||
|
|
838728d47d | ||
|
|
fd6158410a | ||
|
|
6c56a96ba8 | ||
|
|
bb5659574c | ||
|
|
286da42e54 | ||
|
|
3d0b9ddcc0 | ||
|
|
354c072833 | ||
|
|
f85f24a5c8 | ||
|
|
2550a462f9 | ||
|
|
eb7b977d62 | ||
|
|
1c2c701be0 | ||
|
|
a2303f1fde | ||
|
|
a8ac0f6fff | ||
|
|
732eda3d22 | ||
|
|
358954984b | ||
|
|
acb13ea58a | ||
|
|
e8129862d1 | ||
|
|
88e36e7e90 | ||
|
|
eef9d43d01 | ||
|
|
75f3896a86 | ||
|
|
e679ff23b7 | ||
|
|
e6211e69c5 | ||
|
|
1b3ee24aea | ||
|
|
c9309ee2cf | ||
|
|
a28df44cee | ||
|
|
ee866762a3 | ||
|
|
3cb7c83ef4 | ||
|
|
bf755bcb89 | ||
|
|
20bb05e527 | ||
|
|
d5a3213ad8 | ||
|
|
7e496373ef | ||
|
|
1f3c1c7d41 |
4
.github/workflows/maven-publish.yml
vendored
4
.github/workflows/maven-publish.yml
vendored
@@ -46,14 +46,14 @@ jobs:
|
||||
run: mkdir staging && cp Client/target/Client-${{steps.version.outputs.version_tag}}-all.jar staging
|
||||
|
||||
- name: 5 set up a cache for maven
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.m2
|
||||
key: ${{runner.os}}-m2-${{hashFiles('**/pom.xml')}}
|
||||
restore-keys: ${{runner.os}}-m2
|
||||
|
||||
- name: 7 Create Artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ steps.version.outputs.version_tag }}
|
||||
path: staging
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>TikTokLiveJava</artifactId>
|
||||
<groupId>io.github.jwdeveloper.tiktok</groupId>
|
||||
<version>1.8.4-Release</version>
|
||||
<version>1.11.0-Release</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>API</artifactId>
|
||||
@@ -14,7 +14,7 @@
|
||||
<dependency>
|
||||
<groupId>com.google.protobuf</groupId>
|
||||
<artifactId>protobuf-java</artifactId>
|
||||
<version>3.24.1</version>
|
||||
<version>4.26.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -51,6 +51,7 @@
|
||||
</goals>
|
||||
<configuration>
|
||||
<includeMavenTypes>direct</includeMavenTypes>
|
||||
<protocVersion>4.26.1</protocVersion>
|
||||
<inputDirectories>
|
||||
<include>src/main/proto</include>
|
||||
</inputDirectories>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,11 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2024 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.annotations;
|
||||
|
||||
/**
|
||||
* HIGHEST 1
|
||||
* HIGH 2
|
||||
* NORMAL 3
|
||||
* LOW 4
|
||||
* LOWEST 5
|
||||
ORDER -
|
||||
* HIGHEST 1st,
|
||||
* HIGH 2nd,
|
||||
* NORMAL 3rd,
|
||||
* LOW 4th,
|
||||
* LOWEST 5th
|
||||
*/
|
||||
public enum Priority {
|
||||
LOWEST(2), LOW(1), NORMAL(0), HIGH(-1), HIGHEST(-2);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
@@ -22,25 +22,36 @@
|
||||
*/
|
||||
package io.github.jwdeveloper.tiktok.data.events;
|
||||
|
||||
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
|
||||
import io.github.jwdeveloper.tiktok.annotations.EventType;
|
||||
import io.github.jwdeveloper.tiktok.annotations.*;
|
||||
import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastCaptionMessage;
|
||||
import lombok.Value;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Value
|
||||
@EventMeta(eventType = EventType.Message)
|
||||
public class TikTokCaptionEvent extends TikTokHeaderEvent {
|
||||
Long captionTimeStamp;
|
||||
|
||||
String iSOLanguage;
|
||||
|
||||
String text;
|
||||
List<CaptionContent> contents;
|
||||
|
||||
public TikTokCaptionEvent(WebcastCaptionMessage msg) {
|
||||
super(msg.getCommon());
|
||||
captionTimeStamp = msg.getTimeStamp();
|
||||
iSOLanguage = msg.getCaptionData().getLanguage();
|
||||
text = msg.getCaptionData().getText();
|
||||
captionTimeStamp = msg.getTimestampMs();
|
||||
contents = new ArrayList<>();
|
||||
for (WebcastCaptionMessage.CaptionContent captionContent : msg.getContentList())
|
||||
contents.add(new CaptionContent(captionContent));
|
||||
}
|
||||
|
||||
@Value
|
||||
public static class CaptionContent {
|
||||
String iSOLanguage;
|
||||
|
||||
String text;
|
||||
|
||||
public CaptionContent(WebcastCaptionMessage.CaptionContent captionContent) {
|
||||
this.iSOLanguage = captionContent.getLang();
|
||||
this.text = captionContent.getContent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
@@ -58,7 +58,7 @@ public class TikTokCommentEvent extends TikTokHeaderEvent {
|
||||
var builder = WebcastChatMessage.newBuilder();
|
||||
builder.setUser(io.github.jwdeveloper.tiktok.messages.data.User.newBuilder()
|
||||
.setNickname(userName)
|
||||
.setDisplayId(userName)
|
||||
.setUsername(userName)
|
||||
.build());
|
||||
builder.setContentLanguage("en");
|
||||
builder.setVisibleToSender(true);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
@@ -30,19 +30,22 @@ import lombok.Getter;
|
||||
@Getter
|
||||
@EventMeta(eventType = EventType.Control)
|
||||
public class TikTokDisconnectedEvent extends TikTokLiveClientEvent {
|
||||
public static int UNKNOWN_CLOSE_CODE = -1;
|
||||
|
||||
/** Valid CloseFrame code or -1 for unknown */
|
||||
private final int code;
|
||||
private final String reason;
|
||||
|
||||
public TikTokDisconnectedEvent(String reason) {
|
||||
public TikTokDisconnectedEvent(int code, String reason) {
|
||||
this.code = code;
|
||||
this.reason = reason.isBlank() ? "None" : reason;
|
||||
}
|
||||
|
||||
public TikTokDisconnectedEvent() {
|
||||
this("None");
|
||||
public TikTokDisconnectedEvent(String reason) {
|
||||
this(UNKNOWN_CLOSE_CODE, reason);
|
||||
}
|
||||
|
||||
|
||||
public static TikTokDisconnectedEvent of(String reason)
|
||||
{
|
||||
return new TikTokDisconnectedEvent(reason);
|
||||
public boolean isUnknownCloseCode() {
|
||||
return this.code == UNKNOWN_CLOSE_CODE;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
@@ -47,9 +47,9 @@ public class TikTokGoalUpdateEvent extends TikTokHeaderEvent {
|
||||
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();
|
||||
.getContributorsList()
|
||||
.stream()
|
||||
.map(u -> new User(u.getUserId(), u.getDisplayId(), Picture.map(u.getAvatar())))
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
@@ -22,8 +22,7 @@
|
||||
*/
|
||||
package io.github.jwdeveloper.tiktok.data.events;
|
||||
|
||||
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
|
||||
import io.github.jwdeveloper.tiktok.annotations.EventType;
|
||||
import io.github.jwdeveloper.tiktok.annotations.*;
|
||||
import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastInRoomBannerMessage;
|
||||
import lombok.Getter;
|
||||
@@ -35,6 +34,6 @@ public class TikTokInRoomBannerEvent extends TikTokHeaderEvent {
|
||||
|
||||
public TikTokInRoomBannerEvent(WebcastInRoomBannerMessage msg) {
|
||||
super(msg.getHeader());
|
||||
json = msg.getJson();
|
||||
json = msg.getExtraMap().toString();
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
@@ -22,16 +22,14 @@
|
||||
*/
|
||||
package io.github.jwdeveloper.tiktok.data.events;
|
||||
|
||||
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
|
||||
import io.github.jwdeveloper.tiktok.annotations.EventType;
|
||||
import io.github.jwdeveloper.tiktok.annotations.*;
|
||||
import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent;
|
||||
import io.github.jwdeveloper.tiktok.data.models.LinkMicArmy;
|
||||
import io.github.jwdeveloper.tiktok.data.models.Picture;
|
||||
import io.github.jwdeveloper.tiktok.messages.enums.LinkMicBattleStatus;
|
||||
import io.github.jwdeveloper.tiktok.data.models.*;
|
||||
import io.github.jwdeveloper.tiktok.messages.enums.*;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMicArmies;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Triggered every time a battle participant receives points. Contains the current status of the battle and the army that suported the group.
|
||||
@@ -47,13 +45,28 @@ public class TikTokLinkMicArmiesEvent extends TikTokHeaderEvent {
|
||||
|
||||
private final Picture picture;
|
||||
|
||||
private final List<LinkMicArmy> armies;
|
||||
private final Map<Long, LinkMicArmy> armies;
|
||||
|
||||
private final BattleType battleType;
|
||||
|
||||
public TikTokLinkMicArmiesEvent(WebcastLinkMicArmies msg) {
|
||||
super(msg.getCommon());
|
||||
battleId = msg.getId();
|
||||
armies = msg.getBattleItemsList().stream().map(LinkMicArmy::new).toList();
|
||||
picture = Picture.map(msg.getImage());
|
||||
finished = msg.getBattleStatus() == LinkMicBattleStatus.ARMY_FINISHED;
|
||||
battleId = msg.getBattleId();
|
||||
armies = new HashMap<>();
|
||||
picture = Picture.map(msg.getGifIconImage());
|
||||
finished = msg.getTriggerReason() == TriggerReason.TRIGGER_REASON_BATTLE_END;
|
||||
battleType = msg.getBattleSettings().getBattleType();
|
||||
|
||||
switch (battleType) {
|
||||
case BATTLE_TYPE_NORMAL_BATTLE -> // 1v1 | Fields present - armies
|
||||
msg.getArmiesMap().forEach((aLong, userArmies) -> armies.put(aLong, new LinkMicArmy(userArmies)));
|
||||
case BATTLE_TYPE_TEAM_BATTLE -> // 2v2 | Fields present - team_armies
|
||||
msg.getTeamArmiesList().forEach(teamArmy -> armies.put(teamArmy.getTeamId(), new LinkMicArmy(teamArmy.getUserArmies())));
|
||||
case BATTLE_TYPE_INDIVIDUAL_BATTLE -> // 1v1v1 or 1v1v1v1 | Fields present - team_armies
|
||||
msg.getTeamArmiesList().forEach(teamArmy -> armies.put(teamArmy.getTeamId(), new LinkMicArmy(teamArmy.getUserArmies())));
|
||||
case BATTLE_TYPE_1_V_N -> { // 1 vs Many | Have no data for this yet
|
||||
// Most complicated and uncommon battle type - When more data is collected, this will be updated.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
@@ -24,12 +24,15 @@ package io.github.jwdeveloper.tiktok.data.events;
|
||||
|
||||
import io.github.jwdeveloper.tiktok.annotations.*;
|
||||
import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent;
|
||||
import io.github.jwdeveloper.tiktok.data.models.battles.*;
|
||||
import io.github.jwdeveloper.tiktok.messages.enums.LinkMicBattleStatus;
|
||||
import io.github.jwdeveloper.tiktok.data.models.battles.Team;
|
||||
import io.github.jwdeveloper.tiktok.data.models.users.User;
|
||||
import io.github.jwdeveloper.tiktok.messages.data.*;
|
||||
import io.github.jwdeveloper.tiktok.messages.enums.*;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMicBattle;
|
||||
import lombok.*;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Triggered every time a battle starts & ends
|
||||
@@ -44,40 +47,117 @@ public class TikTokLinkMicBattleEvent extends TikTokHeaderEvent
|
||||
*/
|
||||
private final boolean finished;
|
||||
private final List<Team> teams;
|
||||
private final BattleType battleType;
|
||||
|
||||
public TikTokLinkMicBattleEvent(WebcastLinkMicBattle msg) {
|
||||
super(msg.getCommon());
|
||||
battleId = msg.getId();
|
||||
finished = msg.getBattleStatus() == LinkMicBattleStatus.BATTLE_FINISHED;
|
||||
battleId = msg.getBattleId();
|
||||
finished = msg.getAction() == BattleAction.BATTLE_ACTION_FINISH;
|
||||
battleType = msg.getBattleSetting().getBattleType();
|
||||
teams = new ArrayList<>();
|
||||
if (msg.getHostTeamCount() == 2) { // 1v1 battle
|
||||
teams.add(new Team1v1(msg.getHostTeam(0), msg));
|
||||
teams.add(new Team1v1(msg.getHostTeam(1), msg));
|
||||
} else { // 2v2 battle
|
||||
if (isFinished()) {
|
||||
teams.add(new Team2v2(msg.getHostData2V2List().stream().filter(data -> data.getTeamNumber() == 1).findFirst().orElse(null), msg));
|
||||
teams.add(new Team2v2(msg.getHostData2V2List().stream().filter(data -> data.getTeamNumber() == 2).findFirst().orElse(null), msg));
|
||||
} else {
|
||||
teams.add(new Team2v2(msg.getHostTeam(0), msg.getHostTeam(1), msg));
|
||||
teams.add(new Team2v2(msg.getHostTeam(2), msg.getHostTeam(3), msg));
|
||||
switch (battleType) {
|
||||
case BATTLE_TYPE_NORMAL_BATTLE -> { // 1v1 | Fields present - anchor_info, battle_combos
|
||||
for (Long userId : msg.getAnchorInfoMap().keySet())
|
||||
teams.add(new Team(msg.getAnchorInfoOrThrow(userId), msg.getBattleCombosOrThrow(userId)));
|
||||
if (finished) { // Additional fields present - battle_result, armies
|
||||
for (Team team : teams) {
|
||||
Long userId = team.getHosts().get(0).getId();
|
||||
team.setTotalPoints((int) msg.getBattleResultOrThrow(userId).getScore());
|
||||
team.setViewers(msg.getArmiesOrThrow(userId).getUserArmyList().stream().collect(Collectors.toMap(User::new, bua -> (int) bua.getScore())));
|
||||
}
|
||||
}
|
||||
}
|
||||
case BATTLE_TYPE_TEAM_BATTLE -> { // 2v2 | Fields present - anchor_info
|
||||
if (finished) { // Additional fields present - team_battle_result, team_armies
|
||||
for (BattleTeamUserArmies army : msg.getTeamArmiesList()) {
|
||||
Team team = new Team(army.getTeamId(), army.getTeamUsersList().stream()
|
||||
.map(BattleTeamUser::getUserId).map(userId -> new User(msg.getAnchorInfoOrThrow(userId).getUser())).toList());
|
||||
team.setTotalPoints((int) army.getTeamTotalScore());
|
||||
team.setViewers(army.getUserArmies().getUserArmyList().stream().collect(Collectors.toMap(User::new, bua -> (int) bua.getScore())));
|
||||
teams.add(team);
|
||||
}
|
||||
} else { // Additional fields present - team_users
|
||||
for (WebcastLinkMicBattle.TeamUsersInfo teamUsersInfo : msg.getTeamUsersList())
|
||||
teams.add(new Team(teamUsersInfo.getTeamId(), teamUsersInfo.getUserIdsList().stream()
|
||||
.map(userId -> new User(msg.getAnchorInfoOrThrow(userId).getUser())).toList()));
|
||||
}
|
||||
}
|
||||
case BATTLE_TYPE_INDIVIDUAL_BATTLE -> { // 1v1v1 or 1v1v1v1 | Fields present - anchor_info
|
||||
teams.addAll(msg.getAnchorInfoMap().values().stream().map(Team::new).toList());
|
||||
if (finished) { // Additional fields present - team_battle_result, team_armies
|
||||
for (Team team : teams) {
|
||||
Long userId = team.getHosts().get(0).getId();
|
||||
BattleTeamUserArmies army = msg.getTeamArmiesList().stream().filter(btua -> btua.getTeamId() == userId).findFirst().orElseThrow();
|
||||
team.setTotalPoints((int) army.getTeamTotalScore());
|
||||
team.setViewers(army.getUserArmies().getUserArmyList().stream().collect(Collectors.toMap(User::new, bua -> (int) bua.getScore())));
|
||||
}
|
||||
}
|
||||
}
|
||||
case BATTLE_TYPE_1_V_N -> { // 1 vs Many | Have no data for this yet
|
||||
// Most complicated and uncommon battle type - When more data is collected, this will be updated.
|
||||
}
|
||||
}
|
||||
|
||||
// Info:
|
||||
// - msg.getDetailsList() & msg.getViewerTeamList() both only have content when battle is finished
|
||||
// - msg.getDetailsCount() & msg.getViewerTeamCount() always is 2 only when battle is finished
|
||||
// - msg.getHostTeamCount() always is 2 for 1v1 or 4 for 2v2
|
||||
}
|
||||
|
||||
/** 1 host vs 1 host */
|
||||
public boolean is1v1() {
|
||||
return teams.get(0) instanceof Team1v1;
|
||||
return battleType == BattleType.BATTLE_TYPE_NORMAL_BATTLE;
|
||||
}
|
||||
|
||||
/** 2 hosts vs 2 hosts*/
|
||||
public boolean is2v2() {
|
||||
return teams.get(0) instanceof Team2v2;
|
||||
return battleType == BattleType.BATTLE_TYPE_TEAM_BATTLE;
|
||||
}
|
||||
|
||||
/** Up to four users battling each other all on separate teams */
|
||||
public boolean isIndividual() {
|
||||
return battleType == BattleType.BATTLE_TYPE_INDIVIDUAL_BATTLE;
|
||||
}
|
||||
|
||||
/** 1 host vs N hosts | N max value unknown */
|
||||
public boolean isMultiTeam() {
|
||||
return battleType == BattleType.BATTLE_TYPE_1_V_N;
|
||||
}
|
||||
|
||||
public boolean isTie() {
|
||||
return isFinished() && teams.get(0).getTotalPoints() == teams.get(1).getTotalPoints();
|
||||
return isFinished() && isTeamsTie();
|
||||
}
|
||||
|
||||
private boolean isTeamsTie() {
|
||||
int referencePoints = teams.get(0).getTotalPoints();
|
||||
return teams.stream().allMatch(team -> team.getTotalPoints() == referencePoints);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param battleHostName name of host to search
|
||||
* @return Team instance containing name of host or null if no team found */
|
||||
public Team getTeam(String battleHostName) {
|
||||
List<Team> list = getTeams(battleHostName);
|
||||
return list.isEmpty() ? null : list.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param battleHostName name of host to search
|
||||
* @return Team instances not containing name of host */
|
||||
public List<Team> getOpponentTeams(String battleHostName) {
|
||||
List<Team> list = getTeams(battleHostName);
|
||||
return list.isEmpty() ? null : list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param battleHostName name of host to search
|
||||
* @return {@link List<Team>} with host team first, then opponent teams
|
||||
* <p> If host is in neither or teams is empty, returns empty
|
||||
* <p> Otherwise always teams.length in length;
|
||||
*/
|
||||
public List<Team> getTeams(String battleHostName) {
|
||||
if (teams.isEmpty() || teams.stream().noneMatch(team -> team.contains(battleHostName)))
|
||||
return Collections.EMPTY_LIST;
|
||||
Team hostTeam = teams.stream().filter(team -> team.contains(battleHostName)).findFirst().orElseThrow();
|
||||
List<Team> opponentTeams = teams.stream().filter(team -> !team.contains(battleHostName)).toList();
|
||||
List<Team> teams = new ArrayList<>();
|
||||
teams.add(hostTeam);
|
||||
teams.addAll(opponentTeams);
|
||||
return teams;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package io.github.jwdeveloper.tiktok.data.events;
|
||||
|
||||
import io.github.jwdeveloper.tiktok.annotations.*;
|
||||
import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMicBattleItemCard;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@EventMeta(eventType = EventType.Message)
|
||||
public class TikTokLinkMicBattleItemCard extends TikTokHeaderEvent {
|
||||
|
||||
public TikTokLinkMicBattleItemCard(WebcastLinkMicBattleItemCard msg) {
|
||||
super(msg.getCommon());
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
@@ -40,9 +40,9 @@ public class TikTokQuestionEvent extends TikTokHeaderEvent {
|
||||
public TikTokQuestionEvent(WebcastQuestionNewMessage msg) {
|
||||
super(msg.getCommon());
|
||||
var data = msg.getDetails();
|
||||
questionId = data.getId();
|
||||
text = data.getText();
|
||||
time = data.getTimeStamp();
|
||||
questionId = data.getQuestionId();
|
||||
text = data.getContent();
|
||||
time = data.getCreateTime();
|
||||
user = User.map(data.getUser());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
@@ -53,9 +53,9 @@ public class TikTokSubscribeEvent extends TikTokHeaderEvent {
|
||||
public static TikTokSubscribeEvent of(String userName) {
|
||||
return new TikTokSubscribeEvent(WebcastMemberMessage.newBuilder()
|
||||
.setUser(io.github.jwdeveloper.tiktok.messages.data.User.newBuilder()
|
||||
.setDisplayId(userName)
|
||||
.setUsername(userName)
|
||||
.setNickname(userName)
|
||||
.build())
|
||||
.build());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
@@ -35,4 +35,4 @@ public class TikTokUnhandledMemberEvent extends TikTokUnhandledEvent<WebcastMemb
|
||||
public TikTokUnhandledMemberEvent(WebcastMemberMessage data) {
|
||||
super(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
@@ -22,7 +22,7 @@
|
||||
*/
|
||||
package io.github.jwdeveloper.tiktok.data.events.common;
|
||||
|
||||
import io.github.jwdeveloper.tiktok.messages.data.Common;
|
||||
import io.github.jwdeveloper.tiktok.messages.data.*;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@@ -31,7 +31,7 @@ public class TikTokHeaderEvent extends TikTokEvent {
|
||||
private final long roomId;
|
||||
private final long timeStamp;
|
||||
|
||||
public TikTokHeaderEvent(Common header) {
|
||||
public TikTokHeaderEvent(CommonMessageData header) {
|
||||
this(header.getMsgId(), header.getRoomId(), header.getCreateTime());
|
||||
}
|
||||
|
||||
@@ -46,4 +46,4 @@ public class TikTokHeaderEvent extends TikTokEvent {
|
||||
roomId = 0;
|
||||
timeStamp = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
@@ -35,9 +35,15 @@ public class TikTokPreConnectionEvent extends TikTokLiveClientEvent
|
||||
private final LiveUserData.Response userData;
|
||||
private final LiveData.Response roomData;
|
||||
@Setter boolean cancelConnection = false;
|
||||
@Setter String reason = "TikTokPreConnectionEvent cancelled connection!";
|
||||
|
||||
public TikTokPreConnectionEvent(LiveUserData.Response userData, LiveData.Response liveData) {
|
||||
this.userData = userData;
|
||||
this.roomData = liveData;
|
||||
}
|
||||
|
||||
public void setCancelConnection(boolean cancelConnection, String reason) {
|
||||
this.cancelConnection = cancelConnection;
|
||||
this.reason = reason;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
@@ -24,6 +24,7 @@ package io.github.jwdeveloper.tiktok.data.events.link;
|
||||
|
||||
import io.github.jwdeveloper.tiktok.annotations.*;
|
||||
import io.github.jwdeveloper.tiktok.data.models.users.ListUser;
|
||||
import io.github.jwdeveloper.tiktok.messages.enums.LinkmicMultiLiveEnum;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage;
|
||||
import lombok.Getter;
|
||||
|
||||
@@ -34,7 +35,7 @@ import java.util.List;
|
||||
public class TikTokLinkEnterEvent extends TikTokLinkEvent {
|
||||
|
||||
private final List<ListUser> listUsers;
|
||||
private final int anchorMultiLiveEnum;
|
||||
private final LinkmicMultiLiveEnum anchorMultiLiveEnum;
|
||||
|
||||
public TikTokLinkEnterEvent(WebcastLinkMessage msg) {
|
||||
super(msg);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
@@ -23,6 +23,7 @@
|
||||
package io.github.jwdeveloper.tiktok.data.events.link;
|
||||
|
||||
import io.github.jwdeveloper.tiktok.annotations.*;
|
||||
import io.github.jwdeveloper.tiktok.messages.enums.*;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage;
|
||||
import lombok.Getter;
|
||||
|
||||
@@ -30,7 +31,11 @@ import lombok.Getter;
|
||||
@EventMeta(eventType = EventType.Message)
|
||||
public class TikTokLinkMediaChangeEvent extends TikTokLinkEvent {
|
||||
|
||||
private final long op, toUserId, anchorId, roomId, changeScene;
|
||||
private final GuestMicCameraManageOp op;
|
||||
private final long toUserId;
|
||||
private final long anchorId;
|
||||
private final long roomId;
|
||||
private final GuestMicCameraChangeScene changeScene;
|
||||
|
||||
public TikTokLinkMediaChangeEvent(WebcastLinkMessage msg) {
|
||||
super(msg);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
@@ -23,6 +23,7 @@
|
||||
package io.github.jwdeveloper.tiktok.data.events.link;
|
||||
|
||||
import io.github.jwdeveloper.tiktok.annotations.*;
|
||||
import io.github.jwdeveloper.tiktok.messages.enums.MuteStatus;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage;
|
||||
import lombok.Getter;
|
||||
|
||||
@@ -30,7 +31,8 @@ import lombok.Getter;
|
||||
@EventMeta(eventType = EventType.Message)
|
||||
public class TikTokLinkMuteEvent extends TikTokLinkEvent {
|
||||
|
||||
private final long userId, status;
|
||||
private final long userId;
|
||||
private final MuteStatus status;
|
||||
|
||||
public TikTokLinkMuteEvent(WebcastLinkMessage msg) {
|
||||
super(msg);
|
||||
@@ -41,4 +43,8 @@ public class TikTokLinkMuteEvent extends TikTokLinkEvent {
|
||||
this.userId = content.getUserId();
|
||||
this.status = content.getStatus();
|
||||
}
|
||||
|
||||
public boolean isMuted() {
|
||||
return status == MuteStatus.MUTE_STATUS_MUTE;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
@@ -39,7 +39,7 @@ public class TikTokRoomPinEvent extends TikTokHeaderEvent
|
||||
public TikTokRoomPinEvent(WebcastRoomPinMessage msg, TikTokCommentEvent commentEvent)
|
||||
{
|
||||
super(msg.getCommon());
|
||||
this.timestamp = msg.getTimestamp();
|
||||
this.timestamp = msg.getPinTime();
|
||||
this.pinnedMessage = commentEvent;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
@@ -45,7 +45,7 @@ public class TikTokFollowEvent extends TikTokHeaderEvent {
|
||||
public static TikTokFollowEvent of(String userName) {
|
||||
return new TikTokFollowEvent(WebcastSocialMessage.newBuilder()
|
||||
.setUser(io.github.jwdeveloper.tiktok.messages.data.User.newBuilder()
|
||||
.setDisplayId(userName)
|
||||
.setUsername(userName)
|
||||
.setNickname(userName)
|
||||
.build())
|
||||
.build());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
@@ -26,7 +26,6 @@ import io.github.jwdeveloper.tiktok.annotations.EventMeta;
|
||||
import io.github.jwdeveloper.tiktok.annotations.EventType;
|
||||
import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent;
|
||||
import io.github.jwdeveloper.tiktok.data.models.users.User;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLikeMessage;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastMemberMessage;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastSocialMessage;
|
||||
import lombok.Getter;
|
||||
@@ -53,9 +52,9 @@ public class TikTokJoinEvent extends TikTokHeaderEvent {
|
||||
{
|
||||
return new TikTokJoinEvent(WebcastMemberMessage.newBuilder()
|
||||
.setUser(io.github.jwdeveloper.tiktok.messages.data.User.newBuilder()
|
||||
.setDisplayId(userName)
|
||||
.setUsername(userName)
|
||||
.setNickname(userName)
|
||||
.build())
|
||||
.build());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
@@ -62,9 +62,9 @@ public class TikTokLikeEvent extends TikTokHeaderEvent
|
||||
.setCount(likes)
|
||||
.setTotal(likes)
|
||||
.setUser(io.github.jwdeveloper.tiktok.messages.data.User.newBuilder()
|
||||
.setDisplayId(userName)
|
||||
.setUsername(userName)
|
||||
.setNickname(userName)
|
||||
.build())
|
||||
.build());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
@@ -22,11 +22,9 @@
|
||||
*/
|
||||
package io.github.jwdeveloper.tiktok.data.events.social;
|
||||
|
||||
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
|
||||
import io.github.jwdeveloper.tiktok.annotations.EventType;
|
||||
import io.github.jwdeveloper.tiktok.annotations.*;
|
||||
import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent;
|
||||
import io.github.jwdeveloper.tiktok.data.models.users.User;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLikeMessage;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastSocialMessage;
|
||||
import lombok.Getter;
|
||||
|
||||
@@ -52,7 +50,7 @@ public class TikTokShareEvent extends TikTokHeaderEvent {
|
||||
public static TikTokShareEvent of(String userName, int shaders) {
|
||||
return new TikTokShareEvent(WebcastSocialMessage.newBuilder()
|
||||
.setUser(io.github.jwdeveloper.tiktok.messages.data.User.newBuilder()
|
||||
.setDisplayId(userName)
|
||||
.setUsername(userName)
|
||||
.setNickname(userName)
|
||||
.build())
|
||||
.build(), shaders);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
@@ -22,17 +22,11 @@
|
||||
*/
|
||||
package io.github.jwdeveloper.tiktok.data.events.websocket;
|
||||
|
||||
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
|
||||
import io.github.jwdeveloper.tiktok.annotations.EventType;
|
||||
import io.github.jwdeveloper.tiktok.annotations.*;
|
||||
import io.github.jwdeveloper.tiktok.data.dto.MessageMetaData;
|
||||
import io.github.jwdeveloper.tiktok.data.events.common.TikTokEvent;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastGiftMessage;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastResponse;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Value;
|
||||
|
||||
import java.time.Duration;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.ProtoMessageFetchResult;
|
||||
import lombok.*;
|
||||
|
||||
|
||||
|
||||
@@ -47,7 +41,7 @@ public class TikTokWebsocketMessageEvent extends TikTokEvent {
|
||||
* message.payload - Bytes array that contains actual data of message.
|
||||
* Example of parsing, WebcastGiftMessage giftMessage = WebcastGiftMessage.parseFrom(message.getPayload());
|
||||
*/
|
||||
private WebcastResponse.Message message;
|
||||
private ProtoMessageFetchResult.BaseProtoMessage message;
|
||||
|
||||
/*
|
||||
* TikTokLiveJava event that was created from TikTok message data
|
||||
@@ -61,4 +55,4 @@ public class TikTokWebsocketMessageEvent extends TikTokEvent {
|
||||
private MessageMetaData metaData;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
@@ -22,17 +22,15 @@
|
||||
*/
|
||||
package io.github.jwdeveloper.tiktok.data.events.websocket;
|
||||
|
||||
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
|
||||
import io.github.jwdeveloper.tiktok.annotations.EventType;
|
||||
import io.github.jwdeveloper.tiktok.annotations.*;
|
||||
import io.github.jwdeveloper.tiktok.data.events.common.TikTokEvent;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastResponse;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.ProtoMessageFetchResult;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
@EventMeta(eventType = EventType.Debug)
|
||||
public class TikTokWebsocketResponseEvent extends TikTokEvent
|
||||
{
|
||||
private WebcastResponse response;
|
||||
}
|
||||
private ProtoMessageFetchResult response;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
@@ -25,21 +25,19 @@ package io.github.jwdeveloper.tiktok.data.events.websocket;
|
||||
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
|
||||
import io.github.jwdeveloper.tiktok.annotations.EventType;
|
||||
import io.github.jwdeveloper.tiktok.data.events.common.TikTokUnhandledEvent;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastResponse;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.ProtoMessageFetchResult;
|
||||
import lombok.Getter;
|
||||
|
||||
|
||||
|
||||
@Getter
|
||||
@EventMeta(eventType = EventType.Debug)
|
||||
public class TikTokWebsocketUnhandledMessageEvent extends TikTokUnhandledEvent<WebcastResponse.Message>
|
||||
public class TikTokWebsocketUnhandledMessageEvent extends TikTokUnhandledEvent<ProtoMessageFetchResult.BaseProtoMessage>
|
||||
{
|
||||
public TikTokWebsocketUnhandledMessageEvent(WebcastResponse.Message data) {
|
||||
public TikTokWebsocketUnhandledMessageEvent(ProtoMessageFetchResult.BaseProtoMessage data) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
public WebcastResponse.Message getMessage()
|
||||
public ProtoMessageFetchResult.BaseProtoMessage getMessage()
|
||||
{
|
||||
return this.getData();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
@@ -23,27 +23,21 @@
|
||||
package io.github.jwdeveloper.tiktok.data.models;
|
||||
|
||||
import io.github.jwdeveloper.tiktok.data.models.users.User;
|
||||
import io.github.jwdeveloper.tiktok.messages.data.LinkMicArmiesItems;
|
||||
import io.github.jwdeveloper.tiktok.messages.data.BattleUserArmies;
|
||||
import lombok.Value;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Value
|
||||
public class LinkMicArmy {
|
||||
Long armyId;
|
||||
List<Army> armies;
|
||||
int totalPoints;
|
||||
Map<User, Integer> armies;
|
||||
|
||||
public LinkMicArmy(LinkMicArmiesItems army) {
|
||||
armyId = army.getHostUserId();
|
||||
armies = army.getBattleGroupsList()
|
||||
.stream()
|
||||
.map(x -> new Army(x.getUsersList().stream().map(User::map).toList(), x.getPoints()))
|
||||
.toList();
|
||||
}
|
||||
|
||||
@Value
|
||||
public static class Army {
|
||||
List<User> Users;
|
||||
Integer Points;
|
||||
public LinkMicArmy(BattleUserArmies userArmies) {
|
||||
armyId = Long.parseLong(userArmies.getAnchorIdStr());
|
||||
totalPoints = (int) userArmies.getHostScore();
|
||||
armies = userArmies.getUserArmyList().stream().collect(Collectors.toMap(User::new, bua -> (int) bua.getScore()));
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
@@ -30,6 +30,7 @@ import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class Picture {
|
||||
@@ -85,8 +86,7 @@ public class Picture {
|
||||
throw new TikTokLiveException("Unable map downloaded image", e);
|
||||
}
|
||||
|
||||
var bais = new ByteArrayInputStream(baos.toByteArray());
|
||||
try {
|
||||
try (var bais = new ByteArrayInputStream(baos.toByteArray())) {
|
||||
return ImageIO.read(bais);
|
||||
} catch (IOException e) {
|
||||
throw new TikTokLiveException("Unable map downloaded image bytes to Image", e);
|
||||
@@ -97,8 +97,25 @@ public class Picture {
|
||||
return new Picture("");
|
||||
}
|
||||
|
||||
public Picture asUnsigned() {
|
||||
if (link == null || link.isEmpty())
|
||||
return this;
|
||||
// p16-sign-va.tiktokcdn.com -> p16-va.tiktokcdn.com || p16-sign.tiktokcdn.com -> p16.tiktokcdn.com
|
||||
return new Picture(link.replace("-sign-", "-").replace("-sign.", "."));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Picture{link='" + link + "', image=" + image + "}";
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean equals(Object o) {
|
||||
return o == this || o instanceof Picture picture && picture.link != null && picture.link.equals(link);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(link);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
@@ -25,7 +25,7 @@ package io.github.jwdeveloper.tiktok.data.models.badges;
|
||||
public class Badge {
|
||||
|
||||
public static Badge map(io.github.jwdeveloper.tiktok.messages.data.BadgeStruct badge) {
|
||||
return switch (badge.getDisplayType()) {
|
||||
return switch (badge.getBadgeDisplayType()) {
|
||||
case BADGEDISPLAYTYPE_TEXT -> new TextBadge(badge.getText());
|
||||
case BADGEDISPLAYTYPE_IMAGE -> new PictureBadge(badge.getImage());
|
||||
case BADGEDISPLAYTYPE_STRING -> new StringBadge(badge.getStr());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
* Copyright (c) 2023-2024 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
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user