SReject / mTwitch

Twitch normalizer for mIRC
21 stars 8 forks source link

Alt. DisplayName script to remove localized names #20

Closed wallrik closed 7 years ago

wallrik commented 7 years ago

I'm wondering if you can create an alternative version of mTwitch.DisplayName.mrc that removes localized names for people that want that? Or maybe make it an option somehow?

The problem I have is that if I use the mIRC script, it will only show the localized name, since that is the display name.

On Twitch it normally shows both the localized name and the username, and a lot of people (including myself) also use BTTV to completely remove the localized name.

The problem with having only the localized name, for me at least, is that it makes it really difficult to moderate a channel with lots of Korean chatters, because I can't type out their name, or tab-complete it.

Here's an example: 비서91 (bsuh91) Here's his Twitch API Here's his parseline: @badges=premium/1;color=#1E90FF;display-name=비서91;emotes=;id=83baf952-c9b7-4323-844a-91d62a6cec95;mod=0;room-id=36625500;sent-ts=1496084548967;subscriber=0;tmi-sent-ts=1496084549486;turbo=0;user-id=90456573;user-type= :bsuh91!bsuh91@bsuh91.tmi.twitch.tv PRIVMSG #rebebbiz :test

BetterTTV can just replace the name with what's inside the brackets, so that's easy for them. But for IRC we probably need to test the display name for non-alphanumeric characters.

That above parseline would normally look like this: <비서91> test But I think I fixed it now to this: <bsuh91> test

I changed the code to this, and it works fine for me:

  if ($mTwitch.isServer) {
    %dnick = $remove($mTwitch.MsgTags(%tags, display-name), $chr(32), $cr, $lf)
    if ($regex(%dnick,/\W/)) {
      .parseline -it %tags $+(:, %nick, %param)
    }
    elseif (%dnick !== $null && %dnick !=== %nick) {
      .parseline -it %tags $+(:, %dnick, %param)
    }
  }

I figured if %dnick is empty it will return 0 anyway, so there's no need for other checks than the regex for localized check.

I removed that user-name= insertion just to make it easier to read. But maybe you'd also want to add a localized-name= thing or something?

I'm sure more people would be happy with a change like this, so I thought I'd share :)

SReject commented 7 years ago

I've added a command to mTwitch.DIsplayName.mrc for toggling the usage of localized nicks. I have yet to test the feature so will leave this ticket open until its confirmed the feature is working as intended.

/mTwitch.Localization @State  
@State can be on, off, enable, disable or toggle  
    If on or enable localized nicks WILL be displayed
    If off or disable localized nicks WILL NOT be displayed

Just a note here; For realtime discussions on features, improvements or suggestions, feel free to drop by #MircHelp on twitch

wallrik commented 7 years ago

Seems to be working just as planned. I love it. Thank you. Your solution is much more elegant. ;) This is mIRC: mirc And these are the same lines in Twitch - localization is removed from the middle line as expected. twitch

You can try yourself by browsing any Korean streams: https://www.twitch.tv/directory/all/ko

Just a note here; For realtime discussions on features, improvements or suggestions, feel free to drop by #MircHelp on twitch

Awesome. For next time :)