ryanwinchester / tmi.ex

Twitch Messaging Interface for Elixir.
Apache License 2.0
42 stars 7 forks source link

Dynamically joining and leaving channels #8

Closed talk2MeGooseman closed 2 years ago

talk2MeGooseman commented 2 years ago

Hi @ryanwinchester, thanks for your hard work and sharing your Twitch IRC library. I am wondering if you have any advice on getting an already running bot to smoothly join and leave channels? I tried coming up with my own solutions but it resulted in failure (probably because of my limited knowledge). Any advice on what I am doing is even possible right now would be appreciated.

ryanwinchester commented 2 years ago

@talk2MeGooseman I need to add the join function to TMI.

It will dispatch a message to ChannelServer which can dynamically join channels, but it is rate-limited because Twitch rate-limits channel joins. I also need to dispatch part to that as well to make sure it is removed from the join queue if it has not joined yet, but also shut down the channel-specific MessageServer.

ryanwinchester commented 2 years ago

Available in v0.5.1

iex> MyBot.join("channel")
iex> MyBot.part("channel")

please check readme if you are working on an older version since things work differently since >= v0.4

talk2MeGooseman commented 2 years ago

Awesome, thanks for the information and quick turnaround. Right now I am actively using your package for my twitch extension Stream Closed Captioner to send reminder messages to the chat with more complex ideas in the future, and this addition will fuel that idea.

I got lucky that sending messages directly to the chat doesn't actually require joining the chat.