void OnHosted(IChannelInfoChannel channel, HostInformation information) { Logger.Info(this, $"Channel is being hosted by {information.Channel} with {information.Viewers} viewers on {information.Service}"); if (ValidUser(information.Service, information.Channel)) { Hosted?.Invoke(information); } }
void ParseJTVMessage(ChatMessage message) { // jtv: xxx is now hosting you for up to 4 viewers. // jtv: xxx is now hosting you. Match match = Regex.Match(message.Message, "^(?<user>[^ ]+) is now (auto )?hosting you( for up to (?<viewers>[0-9]+) viewers)?\\.$"); if (match.Success) { Hosted?.Invoke(this, new HostInformation { Service = Service, Channel = match.Groups["user"].Value.ToLower(), Viewers = match.Groups["viewers"].Success ? int.Parse(match.Groups["viewers"].Value) : -1 }); return; } Logger.Warning(this, "Unprocessed message from jtv", message.ToString()); }