war-pigeon 0.1.0

An ergonomic Rust client for War Pigeon, the runtime message delivery system.
Documentation
use serde::{Deserialize, Serialize};

/// A Discord Snowflake identifier.
///
/// Snowflakes are unique IDs used by Discord to identify entities such as
/// users, channels, messages, roles, and more.
///
/// ## Notes
/// - Represented as a string to avoid precision loss (they exceed 53-bit integers).
/// - Internally, a Snowflake encodes a timestamp, worker ID, process ID, and increment.
/// - Can be parsed to extract creation time if needed.
pub type DiscordSnowflake = String;

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
/// The different types of mentions in discord.
pub enum DiscordMentions {
    /// Role based mentions.
    #[serde(rename = "roles")]
    Roles,

    /// User based mentions.
    #[serde(rename = "users")]
    Users,

    /// `@everyone` and `@here` based mentions.
    #[serde(rename = "everyone")]
    Everyone,
}

/// Discord channel types.
///
/// NOTE: Types `10`, `11`, and `12` are only available in API v9 and above.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u8)]
pub enum DiscordChannelType {
    /// A text channel within a server.
    GuildText = 0,

    /// A direct message between users.
    Dm = 1,

    /// A voice channel within a server.
    GuildVoice = 2,

    /// A direct message between multiple users.
    GroupDm = 3,

    /// An organizational category that contains up to 50 channels.
    GuildCategory = 4,

    /// A channel that users can follow and crosspost into their own server.
    ///
    /// Formerly called a news channel.
    GuildAnnouncement = 5,

    /// A temporary sub-channel within a `GuildAnnouncement` channel.
    AnnouncementThread = 10,

    /// A temporary sub-channel within a `GuildText` or `GuildForum` channel.
    PublicThread = 11,

    /// A temporary sub-channel within a `GuildText` channel that is only
    /// viewable by those invited and those with the `MANAGE_THREADS` permission.
    PrivateThread = 12,

    /// A voice channel for hosting events with an audience.
    GuildStageVoice = 13,

    /// The channel in a hub containing the listed servers.
    GuildDirectory = 14,

    /// A channel that can only contain threads.
    GuildForum = 15,

    /// A channel that can only contain threads.
    ///
    /// NOTE: The source text for this variant's description was truncated.
    GuildMedia = 16,
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct DiscordPartialEmoji {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub id: Option<DiscordSnowflake>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub animated: Option<bool>,
}