{"id":21991911,"url":"https://github.com/elct9620/hahamut","last_synced_at":"2025-10-08T18:11:24.405Z","repository":{"id":35036158,"uuid":"199144232","full_name":"elct9620/hahamut","owner":"elct9620","description":"The Bahamut Forum's chatbot ruby client implement","archived":false,"fork":false,"pushed_at":"2025-03-11T01:56:54.000Z","size":94,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-11T02:38:02.557Z","etag":null,"topics":["chatbot","gem","ruby","ruby-on-rails"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elct9620.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-27T09:28:56.000Z","updated_at":"2025-03-11T01:56:56.000Z","dependencies_parsed_at":"2025-03-11T02:34:16.394Z","dependency_job_id":"0a745e7d-5857-4afc-bcd9-aabaf50f1e1b","html_url":"https://github.com/elct9620/hahamut","commit_stats":{"total_commits":42,"total_committers":2,"mean_commits":21.0,"dds":"0.33333333333333337","last_synced_commit":"6beef5ea0f82af8931f83daa4ae1df87edfe0a40"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elct9620%2Fhahamut","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elct9620%2Fhahamut/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elct9620%2Fhahamut/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elct9620%2Fhahamut/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elct9620","download_url":"https://codeload.github.com/elct9620/hahamut/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245052619,"owners_count":20553161,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatbot","gem","ruby","ruby-on-rails"],"created_at":"2024-11-29T20:12:08.669Z","updated_at":"2025-10-08T18:11:19.353Z","avatar_url":"https://github.com/elct9620.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hahamut\n\n[![Build Status](https://travis-ci.com/elct9620/hahamut.svg?branch=master)](https://travis-ci.com/elct9620/hahamut) [![Coverage Status](https://coveralls.io/repos/github/elct9620/hahamut/badge.svg?branch=master)](https://coveralls.io/github/elct9620/hahamut?branch=master)\n\nThe [Bahamut Forum](https://gamer.com.tw)'s Chatbot ruby client implements\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'hahamut'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install hahamut\n\n## Usage\n\nIf you are using Rack, just run it\n\n```ruby\nrun Hahamut::Engine\n```\n\nIf you are using Rails, mount it in your `config/routes.rb`\n\n```ruby\nmount Hahamut::Engine =\u003e '/hahamut'\n```\n\n### Configure\n\nThis gem is support multiple chatbot, we can use `#setup` to configure it.\n\n```ruby\n# config/initializers/hahamut.rb\n\nHahamut::Engine.setup do |config|\n\n  # Strong recommendation to put in credentials or environment variables\n  config.register bot_id: 'YOUR_BOT_ID',\n                  token: 'YOUR_BOT_TOKEN',\n                  secret: 'YOUR_BOT_SECRET'\nend\n```\n\n### Handling Event\n\nWhen you setup Hahamut, you can set handler\n\n```ruby\n# config/initializers/hahamut.rb\n\nHahamut::Engine.setup do |config|\n\n  # Your bot register\n\n  # Option 1\n  config.on_message do |bot, event|\n    # Implement your bot behavior\n  end\n\n  # Option 2\n  config.handler = ChatbotHandler\nend\n```\n\n\u003e If you want to use the handler object, you must implement a `#call` method\n\n### Sending Message\n\nCurrent support message types\n\n* Text\n* Image\n* Sticker\n* BotStart\n* BotEvent\n\nWhen you receive a message, you will get the bot instance and event.\nTo send a message, you have to use bot instance to send a message object.\n\n```ruby\nmessage = Hahamut::Message::Text.new(text: 'Hello World')\nbot.send_to 'RECIPIENT_ID', message\n```\n\n\u003e BotStart can accept `init` attribute with BotEvent, it can help you write less JSON for it.\n\u003e This feature will be improved in the future to make it easier to use.\n\n### Upload Image\n\nSame as send a message, we need a bot instance.\nThe result is a `Hahamut::Message::Image` object and you can send to the user directly.\n\n```ruby\nimage = bot.upload('IMAGE_PATH')\nbot.send_to 'RECIPIENT_ID', image\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/elct9620/hahamut. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## Code of Conduct\n\nEveryone interacting in the Hahamut project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/elct9620/hahamut/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felct9620%2Fhahamut","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felct9620%2Fhahamut","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felct9620%2Fhahamut/lists"}