Code question on Chat.vue
Closed this issue · 3 comments
Marco,
I built the project locally and I started looking at what it would take to implement #399 (channel points redeem). Channel points redeem doesn't provide a user state, only username - I think it normally gets displayed in message-text format with no username header.
Looking at Chat.vue ln 30, I see that there is some logic in there to display "John Doe" if there is no user on the chat message. Is this functionality ever used in practice? If not, I am thinking of hiding the viewer-name when there is no user object... then I can reuse the existing IMessageResponse. The alternative would be to introduce new objects (IResponse, IUserlessResponse) and another component (UserlessMessage) to display it.
I think reusing ChatMessage is the better approach. LMK if you agree.
Can't guarantee when I will be able to finish this but I will open a PR sooner or later. Thanks!
-Russ
The john doe stuff is only a fallback, it should never be the case that a user is displayed with john doe. I only added this if something goes wrong with the twitch API.
If you feel like you can tackle this I'd gladly review your PR 👍
The john doe stuff is only a fallback, it should never be the case that a user is displayed with john doe. I only added this if something goes wrong with the twitch API.
If you feel like you can tackle this I'd gladly review your PR 👍
So, I coded everything I thought I needed to make it work, but the redeem
event is never getting triggered by the client. I debugged it for a while and couldn't figure out why. Looking through tmi.js, I found this issue:
It seems like in order to complete this feature I will have to either contribute a patch to tmi.js or change the underlying client implementation. I may be able to work on this still but it's going to require some more time and research.
Looking at the twitch API docs, it looks like maybe I have to send a message to subscribe to channel points redemption messages. Will look into this next time I work on it