{"id":19457960,"url":"https://github.com/sharparam/chatrix","last_synced_at":"2025-12-31T14:43:36.451Z","repository":{"id":9343247,"uuid":"61762104","full_name":"Sharparam/chatrix","owner":"Sharparam","description":"Ruby implementation of the Matrix API","archived":false,"fork":false,"pushed_at":"2022-04-03T01:51:24.000Z","size":153,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-02T22:47:31.378Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Sharparam.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":"2016-06-23T01:06:28.000Z","updated_at":"2018-06-25T17:31:26.000Z","dependencies_parsed_at":"2022-08-07T05:00:55.075Z","dependency_job_id":null,"html_url":"https://github.com/Sharparam/chatrix","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/Sharparam/chatrix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sharparam%2Fchatrix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sharparam%2Fchatrix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sharparam%2Fchatrix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sharparam%2Fchatrix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sharparam","download_url":"https://codeload.github.com/Sharparam/chatrix/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sharparam%2Fchatrix/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265815269,"owners_count":23832880,"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":[],"created_at":"2024-11-10T17:24:51.420Z","updated_at":"2025-12-31T14:43:36.413Z","avatar_url":"https://github.com/Sharparam.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"chatrix\n=======\n\n[![Gem version][gem-badge-img]][gem-badge]\n[![Dependency status][gemnasium-img]][gemnasium]\n[![Build status][travis-img]][travis]\n[![Code climate][cc-img]][cc]\n[![Coverage][coverage-img]][coverage]\n[![Inline docs][inch-img]][inch]\n\nA Ruby implementation of the [Matrix][matrix] API.\n\n## License\n\nCopyright (c) 2016 by Adam Hellberg.\n\nchatrix is licensed under the [MIT License][license-url], see the file\n`LICENSE` for more information.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'chatrix'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install chatrix\n\n## Usage\n### Using the API class `Chatrix::Matrix`\nThis implementation is currently very basic and exposes all the endpoints\nin the `Matrix` class and some sub-classes available as attributes on the\nmain `Matrix` class. Example usage:\n\n```ruby\n# Uses the standard matrix.org homeserver\napi = Chatrix::Matrix.new 'my secret token'\n\n# Join may raise ForbiddenError if client does not have permission\n# to join the room\nif id = api.rooms.actions.join '#myroom:myserver.org'\n  api.rooms.actions.send_message id, 'Hello everyone!'\nend\n```\n\nCurrently there is no asynchronous calls or built-in handling of\nrate-limiting.\n\nAll of the available endpoints *should* be available, if there are some\nmissing that are not deprecated in the official API docs, please open an\nissue about it or add them yourself and submit a PR!\n\n### Using the client class `Chatrix::Client`\nThe client class works as a wrapper around the raw API calls to make working\nwith the API a little easier. It uses the [`wisper`][wisper] gem to broadcast\nstate changes.\n\n```ruby\n# When setting up with an access token, there is no way to obtain your own\n# user ID through the API, so it has to be supplied manually.\nclient = Chatrix::Client.new 'my token', 'my user id'\n\n# This will spawn a new thread that continously syncs against the homeserver\n# to check for new events. It can be stopped by calling Client#stop_syncing.\nclient.start_syncing\n\n# Set up a listener for when a message arrives\nclient.on(:room_message) do |room, message|\n  puts \"(#{room}) #{message.sender}: #{message.body}\"\nend\n\n# We can also listen to messages in a specific room by subscribing to the\n# timeline of that room.\nmyroom = client.get_room '#myroom:myserver.org'\nmyroom.timeline.on(:message) do |room, message|\n  # Reply with a \"Pong!\" if someone sends a message starting\n  # with the word \"ping\", but don't reply to ourselves.\n  if message.body.match(/^\\bping\\b/i) \u0026\u0026 message.sender != client.me\n    room.messaging.send_message 'Pong!'\n  end\nend\n\n# Permissions and room actions can be used with relative ease.\nmyroom.timeline.on(:message) do |room, message|\n  if message.body.match(/^!kickme$/i) \u0026\u0026 message.sender != client.me\n    if room.state.permissions.can? message.sender, :kick\n      room.admin.kick message.sender, 'They asked for it'\n    else\n      room.messaging.send_message \"You do not have kick privileges, #{message.sender}\"\n    end\n  end\nend\n```\n\nWhen subscribing to an event, make sure to\n[not return inside the block][no-return-blocks].\n\n*The client is currently a WIP.*\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies.\nThen, run `rake spec` to run the tests. You can also run `bin/console`\nfor an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`.\n\n## Contributing\n\nBug reports and pull requests are welcome on [GitHub][issues].\n\n[project]: https://github.com/Sharparam/chatrix\n[issues]: https://github.com/Sharparam/chatrix/issues\n[matrix]: http://matrix.org\n[license-url]: http://opensource.org/licenses/MIT\n\n[gem-badge]: https://badge.fury.io/rb/chatrix\n[gem-badge-img]: https://badge.fury.io/rb/chatrix.svg\n[gemnasium]: https://gemnasium.com/github.com/Sharparam/chatrix\n[gemnasium-img]: https://gemnasium.com/badges/github.com/Sharparam/chatrix.svg\n[travis]: https://travis-ci.org/Sharparam/chatrix\n[travis-img]: https://travis-ci.org/Sharparam/chatrix.svg?branch=master\n[cc]: https://codeclimate.com/github/Sharparam/chatrix\n[cc-img]: https://codeclimate.com/github/Sharparam/chatrix/badges/gpa.svg\n[coverage]: https://codeclimate.com/github/Sharparam/chatrix/coverage\n[coverage-img]: https://codeclimate.com/github/Sharparam/chatrix/badges/coverage.svg\n[inch]: http://inch-ci.org/github/Sharparam/chatrix\n[inch-img]: http://inch-ci.org/github/Sharparam/chatrix.svg?branch=master\n\n[wisper]: https://github.com/krisleech/wisper\n[no-return-blocks]: http://product.reverb.com/2015/02/28/the-strange-case-of-wisper-and-ruby-blocks-behaving-like-procs/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharparam%2Fchatrix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsharparam%2Fchatrix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharparam%2Fchatrix/lists"}