TwitchLib / TwitchLib.PubSub

PubSub component of TwitchLib.
38 stars 51 forks source link

Update the Unban and Untimeout events. #24

Closed Insensitivity closed 6 years ago

Insensitivity commented 6 years ago
{
    "type": "MESSAGE",
    "data": {
        "topic": "chat_moderator_actions.UserId.ChannelId",
        "message": "{
            \"data\": {
                \"type\": \"chat_login_moderation\",
                \"moderation_action\": \"unban\",
                \"args\": [
                    \"ifiynn\"
                ],
                \"created_by\": \"Username\",
                \"created_by_user_id\": \"UserId\",
                \"msg_id\": \"\",
                \"target_user_id\": \"247469585\"
            }
        }"
    }
}

I've recently had an issue with mobile users being able to (Ban and Timeout and then) Unban and Untimeout usernames that don't exist. The Untimeout and Unban event still fire, supplying user ids based on god knows what, and if you try to use the twitch api to get the username from the id you get an error (since the user doesn't actually exist).

I used reflection to hook up the WebSocketClient and saw that both the Untimeout and Unban events have the username in their first args array entry. I provided an updated payload above. At the moment I'm using reflection to hook the WebSocketClient.OnMessage event to manually fire Untimeout and Unban events with the username as a new argument. It would be appreciated if you guys could update the UntimeoutArgs and UnbanArgs to include this, as it would save (at least for the people who use it) a call to the GetUser API everytime. I would make a PR myself but I'm a git noob. Thanks in advance

Mahsaap commented 6 years ago

Thanks for the info and someone will get on that.

Keep in mind most of us are busy with RL stuff and have little time for the library. And also twitch updates things sometimes with little or no notice.

Again thanks someone will address this asap on git.

Cheers

swiftyspiffy commented 6 years ago

@Insensitivity issue should be resolved if you use dev branch.