{"id":13410161,"url":"https://github.com/diamondburned/arikawa","last_synced_at":"2025-05-14T21:05:00.185Z","repository":{"id":38377508,"uuid":"231314367","full_name":"diamondburned/arikawa","owner":"diamondburned","description":"A Golang library and framework for the Discord API.","archived":false,"fork":false,"pushed_at":"2025-03-31T21:30:10.000Z","size":1927,"stargazers_count":505,"open_issues_count":33,"forks_count":60,"subscribers_count":15,"default_branch":"v3","last_synced_at":"2025-04-06T14:05:37.451Z","etag":null,"topics":["discord","discord-api","discordbot","framework","go","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/diamondburned.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"diamondburned","liberapay":"diamondburned"}},"created_at":"2020-01-02T05:36:16.000Z","updated_at":"2025-04-05T14:21:26.000Z","dependencies_parsed_at":"2023-10-11T07:06:08.690Z","dependency_job_id":"5a377e0a-9444-44e1-80fa-87eec8f760a1","html_url":"https://github.com/diamondburned/arikawa","commit_stats":{"total_commits":1075,"total_committers":45,"mean_commits":23.88888888888889,"dds":0.3293023255813954,"last_synced_commit":"3a51367bf81fcfb6f5fc7ad9aa9759161b139e4f"},"previous_names":[],"tags_count":122,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diamondburned%2Farikawa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diamondburned%2Farikawa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diamondburned%2Farikawa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diamondburned%2Farikawa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/diamondburned","download_url":"https://codeload.github.com/diamondburned/arikawa/tar.gz/refs/heads/v3","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248749992,"owners_count":21155681,"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":["discord","discord-api","discordbot","framework","go","golang"],"created_at":"2024-07-30T20:01:05.285Z","updated_at":"2025-04-13T16:51:53.144Z","avatar_url":"https://github.com/diamondburned.png","language":"Go","funding_links":["https://github.com/sponsors/diamondburned","https://liberapay.com/diamondburned"],"categories":["Bot Building","API Libraries","Bot建设","Repositories","Libraries"],"sub_categories":["Go"],"readme":"# arikawa\n\n[![ Pipeline Status ][pipeline_img    ]][pipeline    ]\n[![ Report Card     ][goreportcard_img]][goreportcard]\n[![ Godoc Reference ][pkg.go.dev_img  ]][pkg.go.dev  ]\n[![ Examples        ][examples_img    ]][examples    ]\n[![ Discord Gophers ][dgophers_img    ]][dgophers    ]\n[![ Hime Arikawa    ][himeArikawa_img ]][himeArikawa ]\n\nA Golang library for the Discord API.\n\n[dgophers]:     https://discord.gg/7jSf85J\n[dgophers_img]: https://img.shields.io/badge/Discord%20Gophers-%23arikawa-%237289da?style=flat-square\n\n[examples]:     https://github.com/diamondburned/arikawa/tree/v3/0-examples\n[examples_img]: https://img.shields.io/badge/Example-.%2F0--examples%2F-blueviolet?style=flat-square\n\n[pipeline]:     https://github.com/diamondburned/arikawa/actions/workflows/test.yml\n[pipeline_img]: https://img.shields.io/github/actions/workflow/status/diamondburned/arikawa/test.yml?style=flat-square\u0026label=Tests\n\n[pkg.go.dev]:     https://pkg.go.dev/github.com/diamondburned/arikawa/v3\n[pkg.go.dev_img]: https://img.shields.io/badge/%E2%80%8B-reference-007d9c?logo=go\u0026logoColor=white\u0026style=flat-square\n\n[himeArikawa]:     https://hime-goto.fandom.com/wiki/Hime_Arikawa\n[himeArikawa_img]: https://img.shields.io/badge/Hime-Arikawa-ea75a2?style=flat-square\n\n[goreportcard]:     https://goreportcard.com/report/github.com/diamondburned/arikawa\n[goreportcard_img]: https://goreportcard.com/badge/github.com/diamondburned/arikawa?style=flat-square\u0026label=Go%20Report\n\n\n## Library Highlights\n\n- More modularity with components divided up into independent packages, such as\n  the API client and the Websocket Gateway being fully independent.\n- Clear separation of models: API and Gateway models are never mixed together so\n  to not be confusing.\n- Extend and intercept Gateway events, allowing for use cases such as reading\n  deleted messages.\n- Pluggable Gateway cache allows for custom caching implementations such as\n  Redis, automatically falling back to the API if needed.\n- Typed Snowflakes make it much harder to accidentally use the wrong ID (e.g.\n  it is impossible to use a channel ID as a message ID).\n- Working user account support, with much of them in [ningen][ningen]. Please\n  do not use this for self-botting, as that is against Discord's ToS.\n\n[ningen]: https://github.com/diamondburned/ningen\n\n\n## Examples\n\n### [Commands (Hybrid)](https://github.com/diamondburned/arikawa/tree/v3/0-examples/commands-hybrid)\n\ncommands-hybrid is an alternative variant of\n[commands](https://github.com/diamondburned/arikawa/tree/v3/0-examples/commands),\nwhere the program permits being hosted either as a Gateway-based daemon or as a\nweb server using the Interactions Webhook API.\n\nBoth examples demonstrate adding interaction commands into the bot as well as an\nexample of routing those commands to be executed.\n\n### [Simple](https://github.com/diamondburned/arikawa/tree/v3/0-examples/simple)\n\nSimple bot example without any state. All it does is logging messages sent into\nthe console. Run with `BOT_TOKEN=\"TOKEN\" go run .`. This example only\ndemonstrates the most simple needs; in most cases, bots should use the state or\nthe bot router.\n\n**Note** that Discord discourages use of bots that do not use the interactions\nAPI, meaning that this example should not be used for bots.\n\n### [Undeleter](https://github.com/diamondburned/arikawa/tree/v3/0-examples/undeleter)\n\nA slightly more complicated example. This bot uses a local state to cache\neverything, including messages. It detects when someone deletes a message,\nlogging the content into the console.\n\nThis example demonstrates the PreHandler feature of the state library.\nPreHandler calls all handlers that are registered (separately from the session),\ncalling them before the state is updated.\n\n**Note** that Discord discourages use of bots that do not use the interactions\nAPI, meaning that this example should not be used for bots.\n\n### Bare Minimum Bot Example\n\nThe least amount of code recommended to have a bot that responds to a /ping.\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/diamondburned/arikawa/v3/api\"\n\t\"github.com/diamondburned/arikawa/v3/api/cmdroute\"\n\t\"github.com/diamondburned/arikawa/v3/gateway\"\n\t\"github.com/diamondburned/arikawa/v3/state\"\n\t\"github.com/diamondburned/arikawa/v3/utils/json/option\"\n)\n\nvar commands = []api.CreateCommandData{{Name: \"ping\", Description: \"Ping!\"}}\n\nfunc main() {\n\tr := cmdroute.NewRouter()\n\tr.AddFunc(\"ping\", func(ctx context.Context, data cmdroute.CommandData) *api.InteractionResponseData {\n\t\treturn \u0026api.InteractionResponseData{Content: option.NewNullableString(\"Pong!\")}\n\t})\n\n\ts := state.New(\"Bot \" + os.Getenv(\"BOT_TOKEN\"))\n\ts.AddInteractionHandler(r)\n\ts.AddIntents(gateway.IntentGuilds)\n\n\tif err := cmdroute.OverwriteCommands(s, commands); err != nil {\n\t\tlog.Fatalln(\"cannot update commands:\", err)\n\t}\n\n\tif err := s.Connect(context.TODO()); err != nil {\n\t\tlog.Println(\"cannot connect:\", err)\n\t}\n}\n```\n\n\n## Testing\n\nThe package includes integration tests that require `$BOT_TOKEN`. To run these\ntests, do:\n\n```sh\nexport BOT_TOKEN=\"\u003cBOT_TOKEN\u003e\"\ngo test -tags integration -race ./...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiamondburned%2Farikawa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiamondburned%2Farikawa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiamondburned%2Farikawa/lists"}