cdfmlr / muvtuber

Makes your AI vtuber
445 stars 75 forks source link

Twitch integration request #43

Open ilNikk opened 1 year ago

ilNikk commented 1 year ago

Hi! Your code look amazing, its possibile to integrate Twitch.tv chat? Thanks

cdfmlr commented 1 year ago

It's possible and not hard to do (i guess).

However I am not that familiar with twitch. Is there any API or library to get the stream comments from twitch?

ilNikk commented 1 year ago

Hi! thx for reply! there is a easy python API for twitch https://pytwitchapi.readthedocs.io/en/stable/ or also have a IRC connection but idk if it possible grab messages with this https://dev.twitch.tv/docs/irc/

cdfmlr commented 1 year ago

Hi! thx for reply! there is a easy python API for twitch https://pytwitchapi.readthedocs.io/en/stable/ or also have a IRC connection but idk if it possible grab messages with this https://dev.twitch.tv/docs/irc/

Cool. We can take either to make it.

But I won't implement it recently. I am a bit busy this days. (sucks exams). And I plan to works on https://github.com/cdfmlr/muvtuber/issues/32 and https://github.com/cdfmlr/muvtuber/issues/26 first when i am freed to. I believe the Twitch integration jobs will be easier & more clear after these issues resolved.

Meanwhile, please feel free to contribute code to make it if you'd like. . It could be a lot hard cuz, I am sorry for that, everything are not well documented now and you have to read my awful codes to understand anything. But if you're willing to give it a try, the following information may be helpful:

The problem is that the comments getter module is not well designed at first. The blivechat (comments getter for BiliBili) is hard-coupled into the system. So we have to decouple it, make an abstract ChatInput interface (#26 will make this) and then implement it. Another option is passing messages through the TextInFromHTTP interface (see https://github.com/cdfmlr/muvtuberdriver/blob/41390d6aca94ff78f041d2052bf274cfd0286df7/http.go#L21) though it looks more costly.

Let me know if you have any other questions.

ilNikk commented 1 year ago

Thx for your info! I made a draft code that push Twitch message to the driver. In this case i simply use Json POST. i not debugging all containers yet but basicly it work for now!

https://github.com/nicolapanegos/twitchbotio/blob/master/twitchbotio.py

If you have any suggestions I'm listening :D

cdfmlr commented 1 year ago

https://github.com/nicolapanegos/twitchbotio/blob/master/twitchbotio.py

I'm afraid your repo is unreachable (404). 😭

Is it private?

ilNikk commented 1 year ago

Ops sorry, now its public! :) https://github.com/nicolapanegos/twitchbotio