{"id":15204040,"url":"https://github.com/compufox/elephrame","last_synced_at":"2025-08-22T12:39:35.618Z","repository":{"id":48764524,"uuid":"159606158","full_name":"compufox/elephrame","owner":"compufox","description":"mastodon bot framework written in ruby","archived":false,"fork":false,"pushed_at":"2023-07-20T07:44:20.000Z","size":158,"stargazers_count":9,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-18T02:38:15.409Z","etag":null,"topics":["bot","bot-framework","mastodon","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/compufox.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-11-29T04:11:43.000Z","updated_at":"2024-05-31T01:00:29.000Z","dependencies_parsed_at":"2022-08-30T11:41:36.142Z","dependency_job_id":null,"html_url":"https://github.com/compufox/elephrame","commit_stats":{"total_commits":126,"total_committers":2,"mean_commits":63.0,"dds":"0.46031746031746035","last_synced_commit":"6c488c0a6653d4b79799aded885e4467e082915f"},"previous_names":["thezacattacks/elephrame"],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/compufox/elephrame","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compufox%2Felephrame","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compufox%2Felephrame/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compufox%2Felephrame/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compufox%2Felephrame/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/compufox","download_url":"https://codeload.github.com/compufox/elephrame/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compufox%2Felephrame/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271424150,"owners_count":24757335,"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-08-21T02:00:08.990Z","response_time":74,"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":["bot","bot-framework","mastodon","ruby"],"created_at":"2024-09-28T05:06:08.573Z","updated_at":"2025-08-22T12:39:35.564Z","avatar_url":"https://github.com/compufox.png","language":"Ruby","readme":"# Elephrame\n\n[![Gem Version](https://badge.fury.io/rb/elephrame.svg)](https://badge.fury.io/rb/elephrame)\n[RubyDoc](https://www.rubydoc.info/github/theZacAttacks/elephrame/)\n\nElephant-Framework -- by [zac@computerfox.xyz](https://social.computerfox.xyz/@zac)\n\nA framework that helps simplify the creation of bots for mastodon/pleroma\n\nUses [rufus-scheduler](https://github.com/jmettraux/rufus-scheduler) in the backend\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'elephrame'\n```\n\nAnd then execute:\n\n    bundle\n\nOr install it yourself as:\n\n    gem install elephrame\n\n## Quickstart\n\nbot that posts \"trans right are human rights\" every three hours:\n\n```ruby\nrequire 'elephrame'\n\nmy_bot = Elephrame::Bots::Periodic.new '3h'\n\nmy_bot.run do |bot|\n  bot.post(\"trans rights are human rights\")\nend\n```\n\n\t$ INSTANCE=\"https://mastodon.social\" TOKEN=\"your_access_token\" ruby bot.rb\n\nCheck the [examples](https://github.com/theZacAttacks/elephrame/tree/master/examples) directory for more example bots\n\nIf you're new to ruby development in general there is also a [getting started](https://github.com/theZacAttacks/elephrame/tree/master/examples/getting_started.org) document in the examples folder that I would recommend you to read. It takes a high level approach to getting started with ruby, some basic syntax, working with gems, basic project structure, and more!\n\n### Bot Types\n\nSo far the framework support 6 bot types: Periodic, Interact, PeroidInteract, Reply, Command, Watcher\n\n- `Periodic` supports posting on a set schedule\n- `Interact` supports callbacks for each type of interaction (favorites, boosts, replies, follows)\n- `PeriodInteract` supports both of the above (I know, this isn't a good name)\n- `Reply` only supports replying to mentions\n- `Command` supports running code when mentioned with commands it recognizes\n- `Watcher` supports watching streaming timelines (including lists, hashtags, public timeline, local timeline, and user timeline)\n- `TraceryBot` supports automatically loading tracery rules. Overloads post method to automatically expand any text passed through it. This bot type provides certain options that ease the use of tracery grammar rules, please see examples and/or documentation for more explanation.\n- `EbooksBot` provides a very quick and easy way to create an ebooks bot. Please see the example in the examples folder for a detailed explanation. \n- `MarkovBot` provides a quick way to get started with making markov bots. Please see the example in the examples folder.\n\nBoth the Ebooks and Markov bots support a few commands out of the box. `!delete`, `!filter`, and `!help`. These commands will only work when sent from an account that the bot is following. The Ebooks bot supports `!update` as well.\n\nAny time a 'time' string is needed it must be either a 'Duration' or 'Cron' string as parsable by [fugit](https://github.com/floraison/fugit)\n\n## Usage\n\nAll the documentation is over at [RubyDoc](https://www.rubydoc.info/github/theZacAttacks/elephrame/)!\n\nEvery place that accepts a block provides access to the bot object. This allows for easy access to some provided helper methods, as well as the actual mastodon access object.\n\nExposed methods from bot object:\n\n- `client` this is the underlying mastodon rest client we use in the backend. use this to make custom calls to the api for which we don't provide a helper\n- `username` the name of the bot as fetched by verify_credentials\n- `strip_html` (defaults to true) if set, the framework will automatically strip all html symbols from the post content\n- `max_retries` (defaults to 5) the maximum amount of times the framework will retry a mastodon request\n- `failed` a hash that represents the status of the last post or media upload. `failed[:post]` and `failed[:media]`; returns true if it failed, false if it succeeded \n- `post(content, visibility: 'unlisted', spoiler: '', reply_id: '', hide_media: false, media: [])` this provides an easy way to post statuses from inside code blocks\n- `reply(content, *options)` a shorthand method to reply to the last mention (Note: only include the @ for the user who @ed the bot)\n- `reply_with_mentions(content, *options)` similar to `reply` but includes all @s (respects #NoBot)\n- `find_ancestor(id, depth = 10, stop_at = 1)` looks backwards through reply chains for the most recent post the bot made starting at post `id` until it hits `depth` number of posts, or finds `stop_at` number of it's own posts\n- `no_bot?(account_id)` returns true if user with `account_id` has some form of \"#NoBot\" in their bio or their profile fields\n- `fetch_list_id(name)` return the id of a list with given name `name`\n- `fetch_account_id(account_name)` return the id of an account with given handle `account_name`\n\n(See RubyDocs for source code documentation)\n\n## In the Wild!\n\nHere's a list of bots that are currently using this framework. If you are using it, add yourself to this list and submit a pull request!\n\n- [GameBot](https://github.com/theZacAttacks/GameBot)\n- [EnhanceBot](https://github.com/theZacAttacks/EnhanceBot)\n- [RemindMe Bot](https://github.com/theZacAttacks/RemindMeBot)\n- [InstanceEmoji Bot](https://github.com/theZacAttacks/InstanceEmojiBot)\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` 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`. \n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/theZacAttacks/elephrame. 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 Elephrame project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/theZacAttacks/elephrame/blob/master/CODE_OF_CONDUCT.md).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcompufox%2Felephrame","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcompufox%2Felephrame","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcompufox%2Felephrame/lists"}