hqtrivia v0.7.1

Framework for creating HQ Trivia bots

hqtrivia

A small framework for building HQ Trivia and HQ Words bots.

Installation

Add this to your application's shard.yml:

dependencies:
  hqtrivia:
    github: taylorfinnell/hqtrivia

Usage

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

Contributors

Repository

hqtrivia

Owner
Statistic
  • 2
  • 1
  • 0
  • 0
  • 2
  • over 3 years ago
  • May 2, 2018
License

MIT License

Links
Synced at

Sun, 17 Nov 2024 11:06:19 GMT

Languages