bevy_discord/http/
mod.rs

1// Not Accessible Publicly
2
3//! HTTP Client functionality for Discord API interactions.
4//!
5//! This module provides a Bevy plugin wrapper around Serenity's HTTP client,
6//! allowing for easy integration of Discord HTTP capabilities into Bevy applications.
7//!
8//! # Example
9//! ```no_run
10//! use bevy::prelude::*;
11//! use bevy_discord::http::DiscordHttpPlugin;
12//!
13//! App::new()
14//!     .add_plugins(DiscordHttpPlugin::new("your-bot-token-here".to_string()))
15//!     .run();
16//! ```
17
18use crate::res::DiscordHttpResource;
19use bevy_app::{App, Plugin};
20use serenity::http::Http;
21use std::sync::Arc;
22
23/// A Bevy plugin that provides Discord HTTP functionality.
24///
25/// This plugin initializes a Discord HTTP client with the provided bot token
26/// and makes it available throughout the application as a Bevy resource.
27pub struct DiscordHttpPlugin(pub String);
28
29impl Plugin for DiscordHttpPlugin {
30    fn build(&self, app: &mut App) {
31        let http: Arc<Http> = Arc::new(Http::new(&self.0));
32
33        app.insert_resource(DiscordHttpResource::new(http));
34    }
35}