frankvHoof93 / TikTokLiveSharp

Port of TikTok live library for C#
https://vanhoof.dev
Other
139 stars 27 forks source link

[BUG] TikTokLiveManager.AvailableGifts is null - conversion failed #45

Closed IgorAherne closed 8 months ago

IgorAherne commented 8 months ago

Hello, TikTokLiveManager.Instance.AvaialbleGifts always return null, even if TikTokLiveManager.Exists is true and it's connected and working otherwise.

TikTokLiveManager{
        public IReadOnlyDictionary<int, TikTokGift> AvailableGifts => (IReadOnlyDictionary<int, TikTokGift>)client?.AvailableGifts;
}

When checking with breakpoints, it's saying null because the specified cast is not valid

frankvHoof93 commented 8 months ago
  1. Are you sure that 'DowbloadGiftInfo' is set to true on the TTLManager?
  2. Could you put a breakpoint in TTBaseClient.FetchAvailableGifts() to check what the JSON-Response is that it's receiving?
IgorAherne commented 8 months ago

@frankvHoof93 Can't do it, it won't let me place it because it's from metadata: image

IgorAherne commented 8 months ago

However, here is more info from the watch window, at the breakpoint above

I'm not sure how to find it man :D Are you sure that 'DowbloadGiftInfo' is set to true on the TTLManager

image

IgorAherne commented 8 months ago

Could it be failing the cast because it confuses it for the TikTokLiveSharp.Models.HTTP.TikTokGift instead of the TikTokLiveSharp.Events.MessageData.Objects.TikTokGift ?

rsputra24 commented 8 months ago

yes it was because of ambiguity between those two, import it like this using TikTokLiveSharpGift = TikTokLiveSharp.Models.HTTP.TikTokGift; then cast it to TikTokLiveSharpGift

frankvHoof93 commented 8 months ago

This should be resolved in V1.0.0. There is now also an implicit operator that will cast from the HTTP-TikTokGift to the Event-TikTokGift if needed. Please let me know if the issue persists in V1.0.0 by opening a new Github-Issue