pblop/twitch-chat

Enchancement(s): Achievement notifcation on events + on /twitch command not found, attempt to resolve minecraft command instead.

OoLunar opened this issue · 10 comments

Hello! I'm back!

Going off of #12, could we have a notification go off when anything occurs? I.E, a new follow, a raid or a new subscriber? That'd be really cool!

As someone who often has their prefix set to none, meaning all messages and commands get forwarded to Twitch, it can be troublesome to execute MC commands. Usually I have to set a chat prefix, execute the MC command, then remove the prefix again. I see two potential fixes to this:

  • Attempt to resolve unknown Twitch commands into MC commands. This means that when no prefix is set, Twitch commands will take priority over MC commands, but only if they're two conflicting commands with the same name, such as /ban.
  • Have two tabs of chat, one for MC and one for Twitch. The GUI to switch in between the chat tabs only show up when the chat box pops up.
    I can only imagine how much of an issue implementing the chat tabs feature, mainly with GUI being the biggest show-stopper for someone who has no idea what the internals of the project looks like. This is why I'm thinking the first fix is likely the easier one to implement.

Again, thank you so much for your mod! It's been such a huge help to my stream, and even a few of my streaming buddies have taken interest in it! I'm spreading the word of your mod everytime I stream. Looking forward to the next update!

pblop commented

Hey!
So you're the reason my mod has skyrocketed in downloads?

Sorry for the late reply, I've been kind of busy.

The first fix I've implemented somewhat (there's no fallback to Minecraft commands but you can do /twitch commands just fine) after your last issue, I just haven't committed the changes yet.
The second fix, however, is a tad more difficult. I'm really bad at UI, which is part of the reason why I haven't implemented the twitch emote stuff yet.

About the first thing you said, I looked into that, but I think it's going to require a change in the library which I'm using to connect to Twitch. Right now it's a simple IRC client, I've found a more complete one, but it requires a rewrite of some classes. This library would also let me download emotes from Twitch and which may make implementing emotes easier.

It is, however, going to be a one or two weeks until I can start to tackle this, so some of the changes may take a little while.

Hope I've answered everything, and thanks for your interest!!

So you're the reason my mod has skyrocketed in downloads?

While I'm not denying it, it does seem highly unlikely since I only got 20 followers (Twitch)/50 subscribers (Youtube) lol

The second fix, however, is a tad more difficult. I'm really bad at UI, which is part of the reason why I haven't implemented the twitch emote stuff yet.

How ironic! So am I!

It is, however, going to be a one or two weeks until I can start to tackle this, so some of the changes may take a little while.

Are you open to PR's? I don't think the fallback command would be difficult to implement. Usually I only program in C#, but I've started development on a Spigot plugin, and I'm slowly starting to figure out the cruel interesting ways of Java.

pblop commented

I'm totally open to it. I'll push my little fix tomorrow and if you want to PR that would be great!

Will do! Looking forward to it!

pblop commented

It is pushed, do as you wish!

Working on fallback commands right now. Is there a specific formatting style you wish for me to keep? I.E, 2 spaces instead of 4 for tab, or anything else as such?

pblop commented

I think my code pretty much follows the Google Java Style Guide. That means two spaces per tab

Awesome, I'll make sure to try to keep my formatting as such. Over at https://github.com/PabloPerezRodriguez/twitch-chat/blob/master/src/main/java/to/pabli/twitchchat/mixin/ChatMixin.java#L26-L29, what method is the "real method?"

pblop commented

That function is a mixin, which means it's injected into another function and called when that other function is called.
In this case, ChatMixin#sendMessage is injected right at the start of Screen#sendMessage(String, bool) (a Minecraft function). I'm using it to highjack sent messages and stop them from being sent to the server in some instances (when I want to send them to Twitch). This is done by calling info.cancel()

If you want to learn more about mixins, you can read this

Thank you for your explanation! I'll go read up on Mixin's now.