Code Monkey home page Code Monkey logo

unity-twitch-chat's People

Contributors

drrnb avatar fgdidou avatar joshgrrro avatar lexonegit avatar niceandgoodonline avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

unity-twitch-chat's Issues

TwitchConnection.WriteThread check connection

TwitchConnection.WriteThread.cs at line 19:
var stream = tcpClient.GetStream();

can sometimes give this error:
InvalidOperationException: The operation is not allowed on non-connected sockets.

Very random, impossible to reproduce. But maybe add something to verify that TCPClient is actually connected before doing anything.

(issue probably exists in TwitchConnection.ReadThread.cs too)

Status Event MainThread

I think the statusEvent line should be:

MainThread.Instance.Enqueue(() => statusEvent.Invoke(state, message, percentage));

Instead of:

statusEvent.Invoke(state, message, percentage);

irc.JoinChannel() throws an exception

While playing around with this plugin I found that this exception gets thrown when trying to use irc.JoinChannel()
I passed in a string with a valid twitch channel name.

NullReferenceException: Object reference not set to an instance of an object
Lexone.UnityTwitchChat.IRC.JoinChannel (System.String channel) (at ./Library/PackageCache/com.lexonegit.unity-twitch-chat@1645b38432/Runtime/IRC.cs:307)
PrepScreenManager.ConnectIRC () (at Assets/Scripts/UI/PrepScreenManager.cs:105)
UnityEngine.Events.InvokableCall.Invoke () (at <10871f9e312b442cb78b9b97db88fdcb>:0)
UnityEngine.Events.UnityEvent.Invoke () (at <10871f9e312b442cb78b9b97db88fdcb>:0)
UnityEngine.UI.Button.Press () (at ./Library/PackageCache/[email protected]/Runtime/UI/Core/Button.cs:70)
UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at ./Library/PackageCache/[email protected]/Runtime/UI/Core/Button.cs:114)
UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at ./Library/PackageCache/[email protected]/Runtime/EventSystem/ExecuteEvents.cs:57)
UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at ./Library/PackageCache/[email protected]/Runtime/EventSystem/ExecuteEvents.cs:272)
UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
Rewired.Integration.UnityUI.RewiredStandaloneInputModule:ProcessMousePress(MouseButtonEventData) (at Assets/Rewired/Integration/UnityUI/RewiredStandaloneInputModule.cs:1091)
Rewired.Integration.UnityUI.RewiredStandaloneInputModule:ProcessMouseEvent(Int32, Int32) (at Assets/Rewired/Integration/UnityUI/RewiredStandaloneInputModule.cs:992)
Rewired.Integration.UnityUI.RewiredStandaloneInputModule:ProcessMouseEvents() (at Assets/Rewired/Integration/UnityUI/RewiredStandaloneInputModule.cs:976)
Rewired.Integration.UnityUI.RewiredStandaloneInputModule:Process() (at Assets/Rewired/Integration/UnityUI/RewiredStandaloneInputModule.cs:690)
UnityEngine.EventSystems.EventSystem:Update()
Rewired.Integration.UnityUI.RewiredEventSystem:Update() (at Assets/Rewired/Integration/UnityUI/RewiredEventSystem.cs:40)
    public void ConnectIRC()
    {
        // irc.channel = twitchChannelName;
        irc.JoinChannel(twitchChannelName);
        connectButton.interactable = false;
    }

This method gets called from a button press event using the Unity UI system.
I am also using Rewired, which is why it's mentioned a lot in the exception. I don't know if Rewired has anything to do with this error, but I thought it was good to mention.

Implement native Twitch chat-like name colors

Twitch allows you to set your name in any color (hex value) but some colors are adjusted so that they are readable. For example #000000 black is actually displayed as grey.

Another thing is random name colors, which are given to users that have not set their name color manually. The random colors seem to be session based.

So the goal is to implement a similar system but not 1:1

User id is not parsed from message tags

I spent a lot of time trying to find a Twitch API to find out a user's id from their chat nickname to no avail. Now, as I was converting aspects of this project to Swift, I discovered that this information is available in the tags stream. It would be really useful to be able to access this (next time I'm back in Unity, that is!)

Raw example tags with user-id in bold:
@badge-info=subscriber/17;badges=broadcaster/1,subscriber/0,premium/1;client-nonce=0f8d3e0f823c2933c949d1c64c11d979;color=#B8005C;display-name=MichaelForrest;emote-only=1;emotes=305612595:0-14;flags=;id=dbd0c90a-2b74-4de7-a7d1-64256fe8e984;mod=0;room-id=75620578;subscriber=1;tmi-sent-ts=1623257914746;turbo=0;user-id=75620578;user-type=

Example of sending text to chat

Please provide an example in ExampleIRCListener that responds to a message or command from chat with a message back to chat.

if (chatter.message == "!join")
Debug.Log(chatter.tags.displayName + " said !join");

if (chatter.message == "!join")
// I want to send to the twitch channel chat: Thanks for joining!

StreamReader.ReadLine() randomly fails (System.IO.IOException)

When connecting to the IRC, StreamReader.ReadLine() can sometimes fail causing the connection to break. Not sure why it happens. Right now the issue is solved by simply just reconnecting whenever it happens.

You can try reproducing the bug by repeatedly connecting and disconnecting. It's kind of random.

You should also modify TwitchIRC.cs (line 154) to look something like this, so you can actually see the error code.

try { raw = reader.ReadLine(); }
catch (System.Exception e) 
{
  Debug.LogError(e);

  // other code...
}

Changing channel name disallows joining chat

If you had inputted a channel name with the anonymous login and connected, It would've had connected fine.
As soon as you change the channel name in runtime even to the same 1:1 string it'll stop functioning and will not return anything from the chat.

IRC.Connect() is private

Maybe I am missing something.

IRC.Disconnect() can be called but not IRC.Connect(), I cannot find a way to connect other than having the "Connect On Start" bool set to "true".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.