{"id":17681213,"url":"https://github.com/z64/discordcr-plugin","last_synced_at":"2026-04-27T22:33:06.121Z","repository":{"id":80745986,"uuid":"141558463","full_name":"z64/discordcr-plugin","owner":"z64","description":"Proof of concept for collections of event handlers for meew0/discordcr using annotations","archived":false,"fork":false,"pushed_at":"2019-07-14T20:53:25.000Z","size":35,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-30T19:14:17.902Z","etag":null,"topics":["api","crystal","discord","discordcr"],"latest_commit_sha":null,"homepage":null,"language":"Crystal","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/z64.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-19T09:43:48.000Z","updated_at":"2020-03-18T17:40:52.000Z","dependencies_parsed_at":"2023-03-10T23:15:38.701Z","dependency_job_id":null,"html_url":"https://github.com/z64/discordcr-plugin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/z64/discordcr-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z64%2Fdiscordcr-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z64%2Fdiscordcr-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z64%2Fdiscordcr-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z64%2Fdiscordcr-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/z64","download_url":"https://codeload.github.com/z64/discordcr-plugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z64%2Fdiscordcr-plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32358509,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T20:07:02.737Z","status":"ssl_error","status_checked_at":"2026-04-27T20:07:00.910Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["api","crystal","discord","discordcr"],"created_at":"2024-10-24T09:10:31.490Z","updated_at":"2026-04-27T22:33:06.103Z","avatar_url":"https://github.com/z64.png","language":"Crystal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# discordcr-plugin\n\nTODO: Write a description here\n\n## Installation\n\nAdd this to your application's `shard.yml`:\n\n```yaml\ndependencies:\n  discordcr-plugin:\n    github: z64/discordcr-plugin\n```\n\n## Usage\n\n```crystal\n# my_commands.cr\n\n# Describe a plugin with two middleware that will filter incoming\n# events for every event handler in this plugin\n@[Discord::Plugin::Options(middleware: {Prefix.new(\"!\"), ChannelFilter.new(123)})]\nclass MyCommands\n  include Discord::Plugin\n\n  # Create a message_create handler method\n  @[Discord::Handler(event: :message_create)]\n  def do_something(payload, ctx)\n    # Access the client anywhere:\n    client.create_message(payload.channel_id, \"test\")\n  end\n\n  @[Discord::Handler(event: :message_create)]\n  def command_b(payload, ctx)\n    # ..\n  end\n\n  # Functions without annotations are ignored, can be defined for internal\n  # helper methods\n  def some_helper_function(arg)\n    # ..\n  end\n\n  # Use JSON/YAML configure hooks:\n  record Config, some_option : Bool do\n    include JSON::Serializable\n    include YAML::Serializable\n  end\n\n  @config : Config?\n\n  def configure(parser : JSON::PullParser)\n    @config = Config.new(parser)\n  end\n\n  def configure(parser : YAML::PullParser)\n    @config = Config.new(parser)\n  end\nend\n\n# main.cr\n\nrequire \"discordcr-plugin\"\nrequire \"./my_commands\"\n\n# Make a client (or many!)\nclient = Discord::Client.new(token: ENV[\"TOKEN\"])\n\n# Configure all plugins based on their class name:\nFile.open(\"config.json\", \"r\") do |file|\n  parser = JSON::PullParser.new(file)\n  parser.read_object do |key|\n    Discord::Plugin.plugins.each do |plugin|\n      if plugin.class.to_s.underscore == key\n        plugin.configure(parser)\n      else\n        parser.skip\n      end\n    end\n  end\nend\n\n# Register all plugins defined across the codebase:\nDiscord::Plugin.plugins.each do |plugin|\n  client.register(plugin)\nend\n\n# Let's go!\nclient.run\n```\n\nTODO: Write usage instructions here\n\n## Contributors\n\n- [z64](https://github.com/z64) Zac Nowicki - creator, maintainer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fz64%2Fdiscordcr-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fz64%2Fdiscordcr-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fz64%2Fdiscordcr-plugin/lists"}