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

@@ -23,8 +23,9 @@
package io.github.jwdeveloper.tiktok.tools.collector;
import io.github.jwdeveloper.tiktok.TikTokLive;
import io.github.jwdeveloper.tiktok.events.messages.TikTokGiftEvent;
import io.github.jwdeveloper.tiktok.events.messages.*;
import io.github.jwdeveloper.tiktok.events.messages.TikTokJoinEvent;
import io.github.jwdeveloper.tiktok.events.messages.TikTokLikeEvent;
import io.github.jwdeveloper.tiktok.exceptions.TikTokLiveMessageException;
import io.github.jwdeveloper.tiktok.tools.collector.db.TikTokDatabase;
import io.github.jwdeveloper.tiktok.tools.collector.tables.ExceptionInfoModel;
@@ -40,11 +41,7 @@ public class RunCollector {
//https://protobuf-decoder.netlify.app/
//https://streamdps.com/tiktok-widgets/gifts/
/*
mia_tattoo
moniczkka
besin1276
*/
public static List<String> ignoredEvents;
@@ -55,9 +52,14 @@ public class RunCollector {
//ignoredEvents = List.of("TikTokJoinEvent","TikTokLikeEvent");
filter = new ArrayList<>();
filter.add(TikTokGiftEvent.class);
filter.add(TikTokUnhandledSocialEvent.class);
filter.add(TikTokFollowEvent.class);
filter.add(TikTokLikeEvent.class);
filter.add(TikTokShareEvent.class);
filter.add(TikTokJoinEvent.class);
var db = new TikTokDatabase("test");
var db = new TikTokDatabase("social_db");
db.init();
var errors = db.selectErrors();
@@ -113,7 +115,7 @@ public class RunCollector {
var errorModel = new TikTokErrorModel();
if (exception instanceof TikTokLiveMessageException ex) {
errorModel.setHostName(tiktokUser);
errorModel.setErrorName(ex.messageName());
errorModel.setErrorName(ex.messageMethod());
errorModel.setErrorType("error-message");
errorModel.setExceptionContent(exceptionContent);
errorModel.setMessage(ex.messageToBase64());

View File

@@ -0,0 +1,38 @@
/*
* 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.tools.tester;
import io.github.jwdeveloper.tiktok.events.objects.Gift;
public class RefelcionTest {
public static void main(String[] run) throws NoSuchFieldException, IllegalAccessException {
var gift = Gift.PANDA;
var url = gift.getPicture();
var field = gift.getClass().getDeclaredField("picture");
field.setAccessible(true);
field.set(gift, null);
var url2 = gift.getPicture();
}
}

View File

@@ -29,7 +29,7 @@ import io.github.jwdeveloper.tiktok.events.messages.TikTokGiftEvent;
import io.github.jwdeveloper.tiktok.gifts.TikTokGiftManager;
import io.github.jwdeveloper.tiktok.handlers.TikTokEventObserver;
import io.github.jwdeveloper.tiktok.handlers.TikTokMessageHandlerRegistration;
import io.github.jwdeveloper.tiktok.messages.WebcastResponse;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastResponse;
import io.github.jwdeveloper.tiktok.tools.collector.db.TikTokDatabase;
import java.util.Base64;
@@ -75,7 +75,6 @@ public class RunTester {
sb.append(" combo: " + event.getComboCount());
sb.append(" index " + event.getComboIndex());
sb.append(" sender " + event.getSender().getNickName());
sb.append(" finished " + event.getComboFinished());
System.out.println(sb.toString());
});
observer.<TikTokGiftComboFinishedEvent>subscribe(TikTokGiftComboFinishedEvent.class, (liveClient, event) ->