Hotrian / OpenVRTwitchChat

Put your favorite Twitch Chat directly into any OpenVR game!
Other
174 stars 50 forks source link

Cannot connect to channels when their name ends with an underscore #27

Open ItsBrando opened 6 years ago

ItsBrando commented 6 years ago

I cant connect to my twitch account to read my chat, i can connect to other ones just not mine, im not sure if its because of the two underscores in my name or what. Account- ItsBrando__

Hotrian commented 6 years ago

Yeah, I would guess that it may be due to your username’s format. It’s been quite a while since I worked on OVRTC so I’m not sure. That said, I’m also not sure when I can patch this, but I’ll look into it regardless.

ItsBrando commented 6 years ago

Oh don’t worry about it I changed my name on twitch thanks anyways though :)

joseph-allen commented 5 years ago

sounds like a simple string conversion in the right place might do it, if you point me to the file I can give it a go @Hotrian

Hotrian commented 5 years ago

@joseph-allen this one handles the actual Twitch procedures but may not be the one causing issues with the trailing underscore.

joseph-allen commented 5 years ago

i think this is the submission not the chat itself? same as issue 29

Hotrian commented 5 years ago

29 was caused by Unity not being able to draw certain characters afaict. I never finished figuring out what was causing the issue with the trailing underscore as no one else ever brought it up, and @ItsBrando changed his Twitch name so it didn't seem to be an issue for anyone anymore (although I acknowledge there could be other users who have experienced this issue but never took the time to bring it to my attention).

agwosdz commented 3 years ago

I have the same issue with my channel. Channel has two underscores in name, and will not connect.

Issue lies in the TwitchChatTester.cs. Seems like this routine splits the string by "_" to capitalize the first letter. This doesn't work for channel names with "_" in it, since it cannot capitalize ""

public static string ChannelFirstLetterToUpper(string str) { if (str == null) return null;

    var endsWith_ = str.EndsWith("_");
    if (endsWith_) str = str.Substring(0, str.Length - 1);

    if (str.Length <= 1) return str.ToUpper();
    var pieces = str.Split('_');
    var st = "";
    for (var i = 0; i < pieces.Length; i++)
    {
        st += char.ToUpper(pieces[i][0]) + pieces[i].Substring(1);
        if (i < pieces.Length - 1)
            st += "_";
    }
    if (endsWith_) st += "_";
    return st;
}
Hotrian commented 3 years ago

Thanks for bringing that up @agwosdz, I'll look into this as soon as I can.