{"id":15137870,"url":"https://github.com/as1100k/bevy-discord","last_synced_at":"2025-06-13T03:33:52.438Z","repository":{"id":250392721,"uuid":"834342607","full_name":"AS1100K/bevy-discord","owner":"AS1100K","description":"Discord Plugin for Bevy","archived":false,"fork":false,"pushed_at":"2024-10-25T16:31:32.000Z","size":109,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-29T21:01:27.789Z","etag":null,"topics":["bevy","bevy-plugin","discord-bot"],"latest_commit_sha":null,"homepage":"https://docs.rs/bevy-discord","language":"Rust","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/AS1100K.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2024-07-27T02:09:22.000Z","updated_at":"2024-10-25T16:26:41.000Z","dependencies_parsed_at":"2024-10-25T12:10:38.116Z","dependency_job_id":"229a1e06-181f-40ce-8f94-9feee83a05d2","html_url":"https://github.com/AS1100K/bevy-discord","commit_stats":{"total_commits":53,"total_committers":1,"mean_commits":53.0,"dds":0.0,"last_synced_commit":"ca4dbdd0bab9c669ca50b751f14511bfed5191b1"},"previous_names":["as1100k/bevy-discord"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AS1100K%2Fbevy-discord","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AS1100K%2Fbevy-discord/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AS1100K%2Fbevy-discord/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AS1100K%2Fbevy-discord/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AS1100K","download_url":"https://codeload.github.com/AS1100K/bevy-discord/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237834659,"owners_count":19373764,"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":["bevy","bevy-plugin","discord-bot"],"created_at":"2024-09-26T07:03:02.505Z","updated_at":"2025-06-13T03:33:52.424Z","avatar_url":"https://github.com/AS1100K.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bevy Discord Plugin\n\n![GitHub License](https://img.shields.io/github/license/AS1100K/bevy-discord)\n[![Crates.io Version](https://img.shields.io/crates/v/bevy-discord)](https://crates.io/crates/bevy-discord)\n![CI](https://github.com/as1100k/bevy-discord/actions/workflows/ci.yml/badge.svg?event=push)\n\nA very simple, bevy plugin that let you send and receive messages through bevy events.\n\n## Installation\n\nAdd `bevy-discord` as your dependency:\n\n```bash\ncargo add bevy-discord --features full\n```\n\n## Quick Start\n\n\u003cdetails\u003e\n\u003csummary\u003eBasic ping-pong bot\u003c/summary\u003e\n\n```rust,no_run\nuse bevy::prelude::*;\nuse bevy_discord::config::DiscordBotConfig;\nuse bevy_discord::events::bot::BMessage;\nuse bevy_discord::serenity::all::*;\nuse bevy_discord::DiscordBotPlugin;\nuse serde_json::json;\n\nfn main() {\n    // Configure the bot with necessary intents\n    let config = DiscordBotConfig::default()\n        .token(\"YOUR_BOT_TOKEN_HERE\".to_string())\n        .gateway_intents(\n            GatewayIntents::GUILD_MESSAGES\n                | GatewayIntents::MESSAGE_CONTENT\n                | GatewayIntents::GUILDS,\n        );\n\n    App::new()\n        .add_plugins(MinimalPlugins)\n        .add_plugins(bevy::log::LogPlugin {\n            ..Default::default()\n        })\n        .add_plugins(DiscordBotPlugin::new(config))\n        .add_systems(Update, handle_messages)\n        .run();\n}\n\nfn handle_messages(\n    mut messages: EventReader\u003cBMessage\u003e,\n    http: Option\u003cRes\u003cbevy_discord::res::DiscordHttpResource\u003e\u003e,\n) {\n    for message in messages.read() {\n        if let Some(http) = \u0026http {\n            // Skip messages from bots (including our own)\n            if message.new_message.author.bot {\n                continue;\n            }\n\n            let content = \u0026message.new_message.content;\n            let channel_id = message.new_message.channel_id;\n\n            // Simple ping-pong command\n            if content == \"!ping\" {\n                let http = http.client();\n\n                bevy_discord::runtime::tokio_runtime().spawn(async move {\n                    let _ = http\n                        .send_message(\n                            channel_id,\n                            vec![],\n                            \u0026json!({\n                                \"content\": \"Pong! 🏓\"\n                            }),\n                        )\n                        .await;\n                });\n            }\n        }\n    }\n}\n```\n\n_Example taken from `examples/basic_bot.rs`_\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eBasic Rich-presence bot\u003c/summary\u003e\n\n```rust,no_run\nuse bevy::log::tracing_subscriber::fmt::Subscriber;\nuse bevy::prelude::*;\nuse bevy_discord::config::DiscordRichPresenceConfig;\nuse bevy_discord::events::rich_presence::RichPresenceReady;\nuse bevy_discord::res::DiscordRichPresenceRes;\nuse bevy_discord::{DiscordRichPresencePlugin, DiscordSet};\nuse discord_sdk::activity::ActivityBuilder;\nuse discord_sdk::OffsetDateTime;\n\nfn main() {\n    // Initialize tracing subscriber\n    let subscriber = Subscriber::builder()\n        .with_max_level(tracing::Level::DEBUG)\n        .finish();\n    tracing::subscriber::set_global_default(subscriber).expect(\"setting default subscriber failed\");\n\n    let config = DiscordRichPresenceConfig::default()\n        .app(1326097363395411968)\n        .subscriptions(\n            bevy_discord::discord_sdk::Subscriptions::ACTIVITY\n                | bevy_discord::discord_sdk::Subscriptions::USER\n                | bevy_discord::discord_sdk::Subscriptions::OVERLAY,\n        );\n\n    App::new()\n        .add_plugins(MinimalPlugins)\n        .add_plugins(DiscordRichPresencePlugin::new(config))\n        .add_systems(Update, rich_presence_ready.after(DiscordSet))\n        .run();\n}\n\nfn rich_presence_ready(\n    mut events: EventReader\u003cRichPresenceReady\u003e,\n    rich_presence: Res\u003cDiscordRichPresenceRes\u003e,\n) {\n    for event in events.read() {\n        println!(\n            r#\"\n            version: {},\n            user: {:?}\n            \"#,\n            event.version, event.user\n        );\n\n        println!(\"setup_rich_presence\");\n        let current_date_time = OffsetDateTime::now_utc();\n        let new_activity = ActivityBuilder::new()\n            .state(\"bevy-discord\")\n            .details(\"Exploring example rich_presence.rs\")\n            .start_timestamp(current_date_time)\n            .kind(bevy_discord::discord_sdk::activity::ActivityKind::Playing);\n\n        let ds = rich_presence.discord.clone();\n        bevy_discord::runtime::tokio_runtime().spawn(async move {\n            let _ = ds\n                .update_activity(new_activity)\n                .await\n                .expect(\"Failed to update the activity\");\n        });\n    }\n}\n```\n\n_Example taken from `examples/rich_presence.rs`_\n\n\u003c/details\u003e\n\n## Examples\n\nThe `examples/` directory contains several example implementations:\n\n- [`basic_bot.rs`](https://github.com/as1100k/bevy-discord/blob/main/examples/basic_bot.rs) - Simple message handling and response\n- [`reactions.rs`](https://github.com/as1100k/bevy-discord/blob/main/examples/reactions.rs) - Handling reactions and emoji interactions\n- [`slash_commands.rs`](https://github.com/as1100k/bevy-discord/blob/main/examples/slash_commands.rs) - Creating and handling slash commands\n- [`rich_presence.rs`](https://github.com/as1100k/bevy-discord/blob/main/examples/rich_presence.rs) - Simple bevy app which has Discord Rich Presence\n\nTo run an example:\n\n```bash\ncargo run --example \u003cEXAMPLE_NAME\u003e --features \"full docsrs\"\n```\n\nNote: Remember to replace `YOUR_BOT_TOKEN` with your actual Discord bot token.\n\n## Features\n\nThis crate using powerful cargo features.\n\n| Feature                   | Information                                                         |\n|---------------------------|---------------------------------------------------------------------|\n| `bot` _(includes `http`)_ | Discord bot integration for Bevy applications.                      |\n| `http`                    | HTTP Client functionality for Discord API interactions.             |\n| `rich_presence`           | Discord Rich Presence Integration with Bevy. _`(v0.6 and greater)`_ |\n\n_All features are comes under `full` feature._\n\n## Limitations\n\nCurrently, the following Discord/Serenity features are not supported:\n\n| Feature       | Module    |\n|---------------|-----------|\n| `voice`       | `bot`     |\n\n## Versions\n\nThis crate aims to track bevy's versions. It also follows the semver standard. Below is a chart which versions of this\ncrate are compatible with which bevy version:\n\n| Version | Bevy Version |\n|---------|--------------|\n| `0.2.x` | `0.13.x`     |\n| `0.3.x` | `0.13.x`     |\n| `0.4.x` | `0.14.x`     |\n| `0.5.x` | `0.15.x`     |\n| `0.6.x` | `0.16.x`      |\n\n## Contributing\n\nIf you are planning to contribute to `bevy-discord` in any manner, please refer to [`CONTRIBUTING.md`](https://github.com/AS1100K/bevy-discord/blob/main/CONTRIBUTING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fas1100k%2Fbevy-discord","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fas1100k%2Fbevy-discord","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fas1100k%2Fbevy-discord/lists"}