Skip to content

Commit

Permalink
feat: add rich presence support and refactor event handling
Browse files Browse the repository at this point in the history
- Added `rich_presence` feature with necessary dependencies in `Cargo.toml`
- Introduced `ChannelPlugin` and `ChannelRes` for shared event handling
- Refactored event handling to use `EventCollection` for both `bot` and `rich_presence` features
- Updated `DiscordBotPlugin` to use `ChannelRes` for event communication
- Added `DiscordRichPresencePlugin` for integrating Discord Rich Presence
- Created `EventHandler` for handling rich presence events
- Updated system setup to conditionally run based on `ChannelRes` existence
  • Loading branch information
AS1100K committed Jan 6, 2025
1 parent 450e04e commit a27b196
Show file tree
Hide file tree
Showing 14 changed files with 1,231 additions and 836 deletions.
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ license = "MIT"
keywords = ["bevy", "plugin", "discord"]

[features]
full = ["bot", "http"]
full = ["bot", "http", "rich_presence"]
bot = ["tokio/sync", "http"]
http = ["dep:serenity"]
bot_cache = ["serenity/cache"]
rich_presence = ["dep:discord-sdk", "dep:async-trait"]

[dependencies]
bevy_app = "0.15"
Expand All @@ -28,6 +29,8 @@ serenity = { version = "0.12", features = [
paste = "1"
tracing = "0.1"
tokio = { version = "1", features = ["rt-multi-thread", "rt"] }
discord-sdk = { version = "0.4", optional = true }
async-trait = { version = "0.1", optional = true }

[dev-dependencies]
bevy = "0.15.0-rc.3"
Expand Down
80 changes: 0 additions & 80 deletions src/bot/common.rs

This file was deleted.

2 changes: 1 addition & 1 deletion src/bot/event_handlers.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use bevy_ecs::prelude::*;

use crate::bot::events::*;
use crate::events::bot::*;
use crate::http::DiscordHttpResource;

pub(crate) fn handle_b_ready_event(mut events: EventReader<BReadyEvent>, mut commands: Commands) {
Expand Down
Loading

0 comments on commit a27b196

Please sign in to comment.