public override void onUserMessage(userEntry aUser, string aMessage) { if (m_IsActive) { triviaQuestion currentQuestion = getCurrentQuestion(); if (currentQuestion != null) { foreach (string curAnswer in currentQuestion.answers) { if (m_BotBrain.stripPunctuation(curAnswer.ToLower(), true) == m_BotBrain.stripPunctuation(aMessage.ToLower(), true)) { string addendumString = ""; if (!string.IsNullOrEmpty(currentQuestion.addendum)) { addendumString = " " + currentQuestion.addendum; } m_BotBrain.sendDefaultChannelMessage(string.Format(m_BotBrain.localizer.getString("triviaAnswerSuccess"), aUser.Nickname, aMessage) + addendumString); checkCreateParticipant(aUser); m_Scores[aUser]++; advanceToNextQuestion(true); return; } } } } }
public void question(userEntry commandUser, string argumentString) { triviaQuestion currentQuestion = getCurrentQuestion(); if (currentQuestion != null) { m_BotBrain.sendDefaultChannelMessage(string.Format(m_BotBrain.localizer.getString("triviaQuestionCurrent"), getCurrentQuestion().getFormattedTitle())); } }
private bool isTagInQuestion(triviaQuestion aQuestion, string aTag) { foreach (string curTag in aQuestion.tags) { if (m_BotBrain.stripPunctuation(curTag.ToLower(), true) == m_BotBrain.stripPunctuation(aTag.ToLower(), true)) { return(true); } } return(false); }
public override void frame() { if (m_IsActive) { if (m_BotBrain.actionTimer.ElapsedMilliseconds > m_TimeSinceLastAnswer + m_TimeToAnswer) { m_BotBrain.sendDefaultChannelMessage(m_BotBrain.localizer.getString("triviaTimeExpired")); advanceToNextQuestion(true); } else if (m_Throttler.isReady) { m_Throttler.trigger(); string questionString = ""; triviaQuestion currentQuestion = getCurrentQuestion(); if (currentQuestion != null) { questionString = string.Format(m_BotBrain.localizer.getString("triviaQuestionCurrent"), getCurrentQuestion().getFormattedTitle()); } m_BotBrain.sendDefaultChannelMessage(m_BotBrain.localizer.getString("triviaTimeExpired") + " " + questionString); } } }