KittehOrg/KittehIRCClientLib

Getting a message's tags

Closed this issue · 8 comments

Hello,

This is a question, I've started using this lib yesterday and i'm using it with Twitch's IRC servers. I'm currently listening to ChannelMessageEvent and i'm trying to figure out how to check if the user that sent the message is a mod/vip/turbo etc. As far as I can tell what i need to do is to check the message's MessageTags but the only way I see to actually get them is by first getting the getOriginalMessages from the event and then running them through the client's MessageTagManager.getCapabilityTags. Am I missing something or is this the correct way?

Due to an unfortunate oversight, you'll need to grab the original message via event.getOriginalMessages().get(0) in order to have access to the tags.

Thank you for the confirmation, can I expect any improvements to make grabbing MessageTags more convenient in the near future?

A simple fix would be to add an interface for events that can only ever have a single message so you can do

getMessage()
getTags()

It would be relatively simple to implement. If it really is, I don't think it's unreasonable to suggest this could happen relatively quickly, but I am not one of the roadmap planners of KICL so I don't want to hold someone to expectations :P

From IRC: @mbax says yes, and will respond more later

mbax commented

I think it may be worth looking over the current events, figuring out which ones actually involve more than one event, and breaking them apart so the multi-message events can have getOriginalMessages and the events for situations that are only realistically ever going to come from a single message can directly supply the tags (as well as retain maybe a getOriginalMessage method?).

I'll think about this more this weekend, for whether it'll be new API (6.1.0) or a breaking change (7.0.0) based on what sort of change makes things easier to access. Maybe a short term solution followed by a better breaking change.

mbax commented

#262 addresses this.

Great, thank you!

mbax commented

For clarity for anyone searching this later, this is handled in version 7.0.0. Forgot to respond in this issue! :D