{"id":18919729,"url":"https://github.com/kinoppyd/mobb","last_synced_at":"2025-04-15T10:33:45.067Z","repository":{"id":56884112,"uuid":"132254917","full_name":"kinoppyd/mobb","owner":"kinoppyd","description":"The simplest, most lightweight, fastest Bot framework written by Ruby.","archived":false,"fork":false,"pushed_at":"2021-10-27T01:15:11.000Z","size":38,"stargazers_count":31,"open_issues_count":2,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T20:23:22.734Z","etag":null,"topics":["bot","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kinoppyd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-05T14:24:48.000Z","updated_at":"2022-01-26T06:14:26.000Z","dependencies_parsed_at":"2022-08-20T22:31:04.600Z","dependency_job_id":null,"html_url":"https://github.com/kinoppyd/mobb","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kinoppyd%2Fmobb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kinoppyd%2Fmobb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kinoppyd%2Fmobb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kinoppyd%2Fmobb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kinoppyd","download_url":"https://codeload.github.com/kinoppyd/mobb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249051964,"owners_count":21204924,"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":["bot","ruby"],"created_at":"2024-11-08T10:41:13.495Z","updated_at":"2025-04-15T10:33:44.809Z","avatar_url":"https://github.com/kinoppyd.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mobb\n\nMobb is the simplest, most lightweight, fastest Bot framework written by Ruby.\n\n# Install\n\nyou can install Mobb by rubygems like\n\n```\ngem isntall mobb\n```\n\nor you can use a bundler. Writes the following in Gemfile\n\n```\nsource \"https://rubygems.org\"\n\ngem \"mobb\", \"~\u003e 0.1\"\n```\n\nand install\n\n```\nbundle install\n```\n\n# Examples\n\nWrite your logic in `app.rb` like...\n\n```ruby\nrequire 'mobb'\n\nset :name, \"example bot\"\n\non \"hello\" do\n  \"hi! i'm #{settings.name}!\"\nend\n```\n\nand start mobb application\n\n```\nruby app.rb\n```\n\nthen the shell will start to wait for your input, so you can type 'hello' and hit enter, then you get.\n\n```\nhi! i'm example bot!\"\n```\n\n## Helpers\n\nYou can define helper methods like this.\n\n```ruby\nrequire 'mobb'\n\nhelpers do\n  def greet(name)\n    \"Hi #{name}, what't up\"\n  end\nend\n\non \"hello\" do\n  greet(@env.user.name)\nend\n\n```\n\n## Conditions\n\nYou can use conditions `react_to_bot`, `include_myself` and `reply_to_me`.\n\n```ruby\nrequire 'mobb'\nset :service, 'slack'\n\n# Mobb ignore all bot messages, but when set reply_to_bot true, Mobb react all bot messages\n# this example will act infinit loop when receive message 'Yo'\non 'Yo', react_to_bot: true do\n  'Yo'\nend\n\n# This block react only message reply to bot\non /Hi/, reply_to_me: true do\n  \"Hi #{@env.user.name}\"\nend\n```\n\nAnd you can define conditions yourself.\n\n```ruby\nrequire 'mobb'\nset :service, 'slack'\n\nset(:probability) { |value| condition { rand \u003c= value } }\n\non /Yo/, reply_to_me: true, probability: 0.1 do\n  \"Yo\"\nend\n\non /Yo/, reply_to_me: true do\n  \"Ha?\"\nend\n```\n\n# Chain methods\n\nIf you want to act heavy task your bot, you can use chain/trigger syntax.\n\n```ruby\nrequire 'mobb'\n\non /taks start (\\w+)/ do |name|\n  chain 'heavy task1', 'heavy task2', name: name\n  'start!'\nend\n\ntrigger 'heavy task1' do\n  payload = @env.payload\n  sleep 19\n  \"task1 #{payload[:name]} done!\"\nend\n\ntrigger 'heavy task2' do\n  payload = @env.payload\n  sleep 30\n  \"task2 #{payload[:name]} done!\"\nend\n```\n\n# Pass\n\nYou can pass block to use pass keyword\n\n```ruby\nrequire 'mobb'\n\non 'yo' do\n  $stderr.puts 'this block will be pass'\n  pass\n  'this value never evaluted'\nend\n\non 'yo' do\n  $stderr.puts 'catch!'\n  'yo'\nend\n```\n\n# Service handlers\n\nMobb is implemented based on [Repp](https://github.com/kinoppyd/repp) Interface.\nShell and Slack adapter is currently available.\n\n```ruby\nrequire 'mobb'\nset :serice, 'slack'\n\non /hey (\\w+)/ do |someone|\n  \"hey #{someone}, waz up?\"\nend\n```\n\n# TODO\n\n+ Test, Test, Test\n+ Documents\n+ Parallel event handling\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkinoppyd%2Fmobb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkinoppyd%2Fmobb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkinoppyd%2Fmobb/lists"}