A small framework for building HQ Trivia and HQ Words bots.
Add this to your application's shard.yml
:
dependencies:
hqtrivia:
github: taylorfinnell/hqtrivia
require "hqtrivia"
class WordFrequencyBot
include HqTrivia::Bot
getter words
@words = {} of String => Int32
def handle_message(message : HqTrivia::Model::Interaction)
message.metadata.message.split(/\s/).each do |word|
@words[word.downcase] ||= 0
@words[word.downcase] += 1
end
end
end
coordinator = HqTrivia::HqCoordinator.new("us")
HqTrivia.on_show(coordinator) do |show|
bot = WordFrequencyBot.new(coordinator)
bot.play
end
HQ Trivia Messages
HqTriva::Model::Question
HqTriva::Model::QuestionSummary
HqTriva::Model::QuestionFinished
HqTriva::Model::GameSummary
HqTriva::Model::SurveyQuestion
HqTriva::Model::SurveyResults
HqTriva::Model::Checkpoint
HqTriva::Model::CheckpointSummary
HQ Words Messages
HqTriva::Model::ShowWheel
HqTriva::Model::HideWheel
HqTriva::Model::StartRound
HqTriva::Model::EndRound
HqTriva::Model::WordsGameResult
HQ Heart Messages
HeartEpisodeWinners
HeartFinalistIntro
HeartFinalistUploadStatus
HeartFinalistUploadUpdate
HeartFinalistVote
HeartFinalistWalkthrough
HeartPhotoResults
HeartPhotoUpload
HeartPhotoVote
Shared Messages
HqTriva::Model::QuestionClosed
HqTriva::Model::PostGame
HqTriva::Model::Interaction
HqTriva::Model::UnknownMessage
HqTriva::Model::BroadcastStats
HqTriva::Model::BroadcastEnded
HqTriva::Model::Kicked
- taylorfinnell Taylor Finnell - creator, maintainer