pub const GATEWAY_URL: &str = "wss://gateway.discord.gg/?v=10&encoding=json";
pub const API: &str = "https://discord.com/api/v10";
pub const MESSAGE_CACHE_SIZE: usize = 100_000;
pub const ROLE_CACHE_SIZE: usize = 100_000;
pub const GUILD_CACHE_SIZE: usize = 30_000;
pub const RATE_LIMITS_CACHE_SIZE: usize = 50_000;
pub const CHANNEL_CACHE_SIZE: usize = 50_000;
pub const DISCORD_CDN: &str = "https://cdn.discordapp.com";
#[derive(Debug, Clone, Copy)]
pub enum ImageFormat {
Jpeg,
Png,
WebP,
Gif,
Lottie,
}
#[repr(u32)]
#[derive(Debug, Clone, Copy)]
pub enum ImageSize {
X16 = 16,
X32 = 32,
X64 = 64,
X128 = 128,
X256 = 256,
X512 = 512,
X1024 = 1024,
X2048 = 2048,
X4096 = 4096,
}
impl ImageFormat {
pub fn get_extension(&self) -> &'static str {
match self {
Self::Jpeg => ".jpg",
Self::Png => ".png",
Self::WebP => ".webp",
Self::Gif => ".gif",
Self::Lottie => ".json",
}
}
}
impl std::fmt::Display for ImageFormat {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.get_extension())
}
}
#[repr(u32)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ComponentType {
ActionRow = 1,
Button,
StringSelect,
TextInput,
UserSelect,
RoleSelect,
MentionableSelect,
ChannelSelect,
}
#[repr(u32)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ButtonStyle {
Primary = 1,
Secondary,
Success,
Danger,
Link,
}
#[repr(u32)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ChannelType {
GuildText = 0,
DM = 1,
GuildVoice = 2,
GroupDm = 3,
GuildCategory = 4,
GuildAnnouncement = 5,
AnnouncementThread = 10,
PublicThread = 11,
PrivateThread = 12,
GuildStageVoice = 13,
GuildDirectory = 14,
GuildForum = 15,
GuildMedia = 16,
}
#[repr(u32)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum SelectMenuType {
#[default]
StringSelect = 3,
TextInput,
UserSelect,
RoleSelect,
MentionableSelect,
ChannelSelect,
}
#[repr(u32)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum InteractionType {
Ping = 1,
ApplicationCommand,
MessageComponent,
ApplicationCommandAutocomplete,
ModalSubmit,
}
#[repr(u32)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum InteractionContextType {
Guild,
BotDm,
PrivateChanne,
}
#[repr(u32)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum InteractionCallbackType {
Pong = 1,
ChannelMessageWithSource = 4,
DeferredChannelMessageWithSource = 5,
DeferredUpdateMessage = 6,
UpdateMessage = 7,
ApplicationCommandAutocompleteResult = 8,
Modal = 9,
PremiumRequired = 10,
}