{"id":16724280,"url":"https://github.com/badboy/jabbot","last_synced_at":"2025-10-06T03:47:17.903Z","repository":{"id":533421,"uuid":"162548","full_name":"badboy/jabbot","owner":"badboy","description":"Simple framework for creating Jabber/MUC bots, inspired by Sinatra and Twibot","archived":false,"fork":false,"pushed_at":"2016-02-01T02:23:00.000Z","size":258,"stargazers_count":26,"open_issues_count":2,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-10-03T06:58:49.550Z","etag":null,"topics":[],"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/badboy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-03-29T19:07:43.000Z","updated_at":"2023-04-19T20:31:47.000Z","dependencies_parsed_at":"2022-07-07T14:40:23.597Z","dependency_job_id":null,"html_url":"https://github.com/badboy/jabbot","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/badboy/jabbot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badboy%2Fjabbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badboy%2Fjabbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badboy%2Fjabbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badboy%2Fjabbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/badboy","download_url":"https://codeload.github.com/badboy/jabbot/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badboy%2Fjabbot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278556187,"owners_count":26006079,"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","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-10-12T22:44:38.117Z","updated_at":"2025-10-06T03:47:17.883Z","avatar_url":"https://github.com/badboy.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jabbot\n\n## Description\n\nJabbot is a Ruby micro-framework for creating Jabber/MUC bots, heavily inspired by Sinatra and Twibot.\n\nI modified the code of Twibot to fit my needs. The original Twibot code is located at: \u003chttp://github.com/cjohansen/twibot\u003e\n\nA big thank you to Christian Johansen, who wrote the code for Twibot. Jabbot is heavily based on his code.\n\nIf your curious if this code is stable enough:\nI have a bot instance running on my server for years now and it works great :)\n\nJust keep in mind that the code is not the most beautiful, maybe has bugs or rough edges. Feel free to improve it. I use it as is.\n\n\n## Usage\n\n### Simple example\n\n~~~ruby\nconfigure do |conf|\n  conf.login    = \"my_account\"\n  conf.password = \"my_account\"\n  conf.nick     = \"mybot\"\n  conf.channel  = \"mychannel\"\nend\n\n# Receive messages, and post them publicly\nmessage do |message, params|\n  post message.text\nend\n\n# Respond to query if they come from the right crowd\n# query \"message\" =\u003e \"user\" is just some syntax sugar\n# query \"message\", \"user\" will work, too\nquery :from =\u003e [:cjno, :irbno] do |message, params|\n  post \"#{message.user} I agree\" =\u003e message.user\nend\n\n# Log every single line\n# (you can use \"message :all\" too ;)\nmessage do |message, params|\n  MyApp.log_message(message)\nend\n~~~\n\n### Running the bot\n\nTo run the bot, simply do:\n\n~~~\nruby bot.rb\n~~~\n\nJabbot uses the [at\\_exit hook](http://ruby-doc.org/core/classes/Kernel.html#M005932) to start.\n\n### Configuration\n\nYou have to configure your bot via ruby:\n\n~~~ruby\nconfigure do |conf|\n  conf.login = \"my_account\"\n  conf.nick = \"mybot\"\nend\n~~~\n\nIf you don't specify login and/or password in any of these ways, Jabbot will fail. The nick is automatically set to \"jabbot\" unless something different is defined. If you want you can set the XMPP Resource:\n\n~~~ruby\nconfigure do |conf|\n  conf.resource =\"mybot_resource\"\nend\n~~~\n\nDefault resource is \"jabbot\".\n\n### \"Routes\"\n\nLike Sinatra, and other web app frameworks, Jabbot supports \"routes\":\npatterns to match incoming messages:\n\n    message \"time :country :city\" do |message, params|\n      time = MyTimeService.lookup(params[:country], params[:city])\n      post \"Time is #{time} in #{params[:city]}, #{params[:country]}\"\n    end\n\nYou can have several \"message\" blocks (or \"join\", \"leave\", \"query\" or \"subject\").\nEvery matching block will be called.\n\nJabbot also supports regular expressions as routes:\n\n~~~ruby\nmessage /^time ([^\\s]*) ([^\\s]*)/ do |message, params|\n  # params is an array of matches when using regexp routes\n  time = MyTimeService.lookup(params[0], params[1])\n  post \"Time is #{time} in #{params[:city]}, #{params[:country]}\"\nend\n~~~\n\nIf all you need is exact word matching you can say so:\n\n~~~ruby\nmessage :exact =\u003e \"pattern\" do |message, params|\n  ...\nend\n~~~\n\nInternally this pattern is translated to `/\\Apattern\\Z/`, so you can use regex literals.\n\n## Requirements\n\n* xmpp4r. You'll need atleast 0.4. You can get it via rubygems: `gem install xmpp4r`\n* eventmachine. `gem install eventmachine`\n\n\n## Installation\n\nJabbot is available via gem:\n\n~~~\ngem install jabbot\n~~~\n\n## Is it Ruby 1.9?\n\nAbsolutely! I run it on 1.9.3 without problems (thanks to the updated xmpp4r).\n\n## Is it Ruby 2.x?\n\nIt should, test pass. I'm not sure if it will work as expected.\n\n## Samples\n\nThere are two examples in the [samples][] directory:\n\n* [jabbot_example.rb][] is a working sample without real functionality.\n* [black.rb][] is the code I use for my own bot (without the config of course).\n\n## Contributors\n\n* Christian Johansen (cjohansen) (author of Twibot) - http://www.cjohansen.no\n\n## License\n\nThe code is released under the MIT license. See [LICENSE][].\n\n## Contribute\n\nIf you'd like to hack on jabbot, start by forking my repo on GitHub:\n\nhttp://github.com/badboy/jabbot\n\nThen:\n\n1. Clone down your fork\n2. Create a thoughtfully named topic branch to contain your change\n3. Hack away\n4. Add tests and make sure everything still passes by running `rake`\n5. If you are adding new functionality, document it in the README\n6. Do not change the version number, I will do that on my end\n7. If necessary, rebase your commits into logical chunks, without errors\n8. Push the branch up to GitHub\n9. Send me (badboy) a pull request for your branch\n\n[LICENSE]: http://github.com/badboy/jabbot/blob/master/LICENSE\n[jabbot_example.rb]: http://github.com/badboy/jabbot/blob/master/samples/jabbot_example.rb\n[black.rb]: http://github.com/badboy/jabbot/blob/master/samples/black.rb\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbadboy%2Fjabbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbadboy%2Fjabbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbadboy%2Fjabbot/lists"}