Пример #1
0
        internal static Task HandlePrivmsgMessage(IrcClient client, IrcMessage message)
        {
            // Check if it's a cheer message and handle event, otherwise pass it to IrcClient.HandleTargetedMessage.
            if (message.Tags.ContainsKey("bits"))
            {
                IrcTargetedMessage targetedMessage = new IrcTargetedMessage(client, message);
                TwitchUser         user            = (TwitchUser)targetedMessage.Source;
                TwitchChannel      channel         = (TwitchChannel)targetedMessage.Target;
                int bits = Convert.ToInt32(message.Tags["bits"]);

                var e = new TwitchCheerEventArgs(user, channel, targetedMessage.Message, bits);
                ((TwitchIrcClient)client).OnUserCheered(e);
            }
            else
            {
                IrcMessageHandlers.HandleTargetedMessage(client, message);
            }

            return(Task.CompletedTask);
        }
Пример #2
0
 /// <summary>
 ///     Raises the <see cref="UserCheered"/> event.
 /// </summary>
 /// <param name="e">The <see cref="EventArgs"/> instance holding the event data.</param>
 internal void OnUserCheered(TwitchCheerEventArgs e)
 {
     UserCheered?.Invoke(this, e);
 }