mumixam / weechat-twitch

Checks status of streams using twitch api
31 stars 9 forks source link

Add WeeChat Message Tags to Printed Messages #14

Open Techman opened 3 years ago

Techman commented 3 years ago

Hello,

I have the WeeChat logger set to level 3 for all channels (/set logger.level.irc.twitch 3), and I was looking back at some scrollback where I noticed that the scripts various notice-like messages are not being stored. Upon further inspection, it looks like this is because there are no relevant message tags added to the weechat.prnts.

Normal tags from a channel notice sent by tmi.twitch.tv: irc_notice,notify_message,nick_tmi.twitch.tv,host_tmi.twitch.tv,log1

Based on this, I think adding log1 will fix my particular issue. It might be worth adding notify_message as well, so that people who have their hotlists configured accordingly will be notified on Twitch-specific messages.

Techman commented 3 years ago

Found some documentation on this that might be helpful. I am thinking possibly looking into this myself, but I need to figure out exactly how highlights work. Not sure what determines what is a highlight: the script or plugin, or some internal system for WeeChat?

Looks like printf_date_tags is the function that is needed to write messages with a tag. The user's guide includes a convenient list of common tags, so that is nice.

mumixam commented 2 years ago

Ok, i see what you are talking about messages like this are not logged when using level 3

--- USER subscribed at Tier 1. They've subscribed for 16 months!

I changed that line in the script over to weechat.prnt_date_tags(buffer, 0, 'irc_notice,log3', '%s--%s %s' % (pcolor, ccolor, msg))

and now it appears to be logging.

note: logX is required or it wont log at all

try this branch https://github.com/mumixam/weechat-twitch/tree/log_notice

Techman commented 2 years ago

Yep, I do see the messages logged now!

I would also prefer to have the stream titles logged as well. I noticed that not all of the old prints (outside of debug) were changed to the tags.

I think notify_message should be added as well, although it might require conditions at every print to take into account the setting where you can suppress the notify level for notices.

I did get an email notification that had your previous message in it. I'm not sure if irc_notice does anything useful. It can probably be removed without causing issues. I can test that too if you want.

mumixam commented 2 years ago

yea i actually have code in the script that strips the notify for notices as i didn't like my buflist turning yellow like someone was sending messages to the channel when someone started hosting another channel. i think having notify_message without having irc_notice or irc_privmsg will make the messages appear like JOIN/PART/QUIT messages would on a normal irc server (as buflist would call none level messages)