{"id":16085506,"url":"https://github.com/subsoap/discordrich","last_synced_at":"2026-02-25T02:32:43.408Z","repository":{"id":46984300,"uuid":"141224388","full_name":"subsoap/discordrich","owner":"subsoap","description":"Rich Presence for Defold games on Discord","archived":false,"fork":false,"pushed_at":"2021-09-19T01:46:53.000Z","size":1063,"stargazers_count":14,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-11-06T09:25:51.778Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/subsoap.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-17T03:10:02.000Z","updated_at":"2025-01-30T11:00:20.000Z","dependencies_parsed_at":"2022-08-28T14:12:59.246Z","dependency_job_id":null,"html_url":"https://github.com/subsoap/discordrich","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/subsoap/discordrich","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subsoap%2Fdiscordrich","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subsoap%2Fdiscordrich/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subsoap%2Fdiscordrich/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subsoap%2Fdiscordrich/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/subsoap","download_url":"https://codeload.github.com/subsoap/discordrich/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subsoap%2Fdiscordrich/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29809086,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T22:43:48.403Z","status":"online","status_checked_at":"2026-02-25T02:00:07.329Z","response_time":61,"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-09T13:01:59.626Z","updated_at":"2026-02-25T02:32:43.393Z","avatar_url":"https://github.com/subsoap.png","language":"C++","funding_links":[],"categories":["Libraries"],"sub_categories":["Programming Language"],"readme":"# DiscordRich\n\nRich Presence for Defold games on Discord\n\nhttps://discordapp.com/developers/docs/rich-presence/how-to\n\n## Getting started\n\nThe minimum you should do is initialize the module, then call `update_presence()`\nwhenever you want to change the user's Defold status.\nThis discord_client_id must be set as a string, like: `\"8674360155089048561\"`\n\n```lua\ndiscordrich.initialize(your_discord_client_id)\ndiscordrich.update_presence({\n  status = \"My status\",\n  details = \"Doing something important in-game\",\n})\n```\n\n### Running in the editor\n\nThe game will bundle fine, but in order for DiscordRich to be available when running\nfrom the editor, an extra step is required.\n\nCopy the `discordrich/res` directory from this repo to a directory in your project\nand add the path to that directory to your `game.project`:\n\n```\n[discordrich]\nlib_path = path/to/discordrich/res\n```\n\n## API Reference\n\nThis module should have 1-to-1 bindings to the official C Discord RPC. All\nidentifiers have been converted to `snake_case`.\n\nRead the [official How To Guide][howto] to understand how to use these APIs.\n\n[howto]: https://discordapp.com/developers/docs/rich-presence/how-to\n\n### `discordrich.initialize(application_id, handlers, auto_register, optional_steam_id)`\n\nInitializes Discord RPC.\n\n* `application_id`: Your client_id/application_id\n* `handlers`: *Optional.* A table of callback functions you registered for each Discord event\n* `auto_register`: *Optional. Default `true`.* Whether or not to register an application protocol for your game on the player's computer. Necessary to launch games from Discord\n* `optional_steam_id`: *Optional.* Your game's Steam application id, if your game is distributed on Steam. Used for launching your game through Steam if `auto_register` is `true`.\n\n### `discordrich.shutdown()`\n\nShuts down the Discord RPC connection. **There's no need to call this manually.\nIt will get called automatically, if needed, when the game exits.**\n\n### `discordrich.update_presence(presence)`\n\nSets your Discord presence. See\n[the available fields](https://discordapp.com/developers/docs/rich-presence/how-to#updating-presence-update-presence-payload-fields)\nin the official documentation. **The fields have been renamed to conform\nto `snake_case`.** (eg. `largeImageText` -\u003e `large_image_text`)\n\n### `discordrich.clear_presence()`\n\nClears your Discord presence.\n\n### The `handlers` table of callbacks\n\nAll of the following callbacks are optional:\n\n#### `handlers.ready(user)`\n\nCalled when the game successfully connects to the Discord client. `user` is a\ntable describing the currently logged in user:\n\n```lua\n{\n  user_id = \"123456789012345678\",\n  username = \"AwesomeGamer\",\n  avatar = \"0123456789abcdef01234567890abcde\",\n  discriminator = \"1234\"\n}\n```\n\n#### `handlers.disconnected(errcode, message)`\n\nCalled when the game disconnects from the Discord client. A numeric `errcode`\nand a string `message` are provided describing the reason.\n\n#### `handlers.errored(errcode, message)`\n\nCalled when the Discord RPC API raises an error. A numeric `errcode`\nand a string `message` are provided describing the error.\n\n#### `handlers.join_game(join_secret)`\n\nCalled when the game launches as a result of the user clicking \"Join\" on another\nplayer's invitation. `join_secret` is the string provided to\n`discordrich.update_presence()` by the inviting player's game.\n\n#### `handlers.spectate_game(spectate_secret)`\n\nCalled when the game launches as a result of the user clicking \"Spectate\" on another\nplayer's invitation. `spectate_secret` is the string provided to\n`discordrich.update_presence()` by the inviting player's game.\n\n#### `handlers.join_request(user)`\n\nCalled when another `user` clicks \"Ask to Join\" on the current user's profile.\nThis is when your game should ask the user if he wants to accept the request and\nthen call `discordrich.respond()` with the user's answer.\n\nThe `user` table has the same shape as the one provided by `handlers.ready()`.\n\n### `discordrich.respond(user_id, answer)`\n\nRespond to a join request issued by the user identified by `user_id`. `answer`\nmust be one of:\n\n* `discordrich.REPLY_NO`\n* `discordrich.REPLY_YES`\n* `discordrich.REPLY_IGNORE`\n\n### `discordrich.update_handlers(handlers)`\n\nChange the `handlers` callbacks with different ones.\n\n### `discordrich.register(application_id, command)`\n\nRegister the game's application protocol manually (`auto_register` does this\nautomatically for you).\n\n### `discordrich.register_steam(application_id, steam_id)`\n\nRegister the game's application protocol manually to launch the game through\nSteam. (`auto_register` does this automatically for you).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubsoap%2Fdiscordrich","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsubsoap%2Fdiscordrich","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubsoap%2Fdiscordrich/lists"}