private void Chat_OnPollEndOccurred(object sender, ChatPollEventModel pollResults) { ChannelSession.Chat.OnPollEndOccurred -= Chat_OnPollEndOccurred; Task.Run(async() => { try { Dictionary <string, uint> results = new Dictionary <string, uint>(); foreach (string answer in pollResults.answers) { if (pollResults.responses.ContainsKey(answer)) { results[answer] = pollResults.responses[answer].ToObject <uint>(); } } if (results.Count > 0) { var winner = results.OrderByDescending(r => r.Value).First(); if (winner.Value > 0) { CommandBase command = ChannelSession.AllEnabledCommands.FirstOrDefault(c => c.ID.Equals(this.CommandID)); if (command != null) { this.extraSpecialIdentifiers["pollresultanswer"] = winner.Key; this.extraSpecialIdentifiers["pollresulttotal"] = winner.Value.ToString(); await command.Perform(arguments: this.lastArguments, extraSpecialIdentifiers: this.GetExtraSpecialIdentifiers()); } } } } catch (Exception ex) { Logger.Log(ex); } }); }
private void ChatClient_OnPollEndOccurred(object sender, ChatPollEventModel e) { }
private void ChatClient_PollStartOccurred(object sender, ChatPollEventModel e) { }