pub const EMBED_MAX_LENGTH: u16 = 6000;
pub const GATEWAY_VERSION: u8 = 6;
pub const VOICE_GATEWAY_VERSION: u8 = 3;
pub const LARGE_THRESHOLD: u8 = 250;
pub const MESSAGE_CODE_LIMIT: u16 = 2000;
pub const USER_AGENT: &str = concat!(
"DiscordBot (https://github.com/serenity-rs/serenity, ",
env!("CARGO_PKG_VERSION"),
")"
);
pub static JOIN_MESSAGES: &[&str] = &[
"$user just joined the server - glhf!",
"$user just joined. Everyone, look busy!",
"$user just joined. Can I get a heal?",
"$user joined your party.",
"$user joined. You must construct additional pylons.",
"Ermagherd. $user is here.",
"Welcome, $user. Stay awhile and listen.",
"Welcome, $user. We were expecting you ( ͡° ͜ʖ ͡°)",
"Welcome, $user. We hope you brought pizza.",
"Welcome $user. Leave your weapons by the door.",
"A wild $user appeared.",
"Swoooosh. $user just landed.",
"Brace yourselves. $user just joined the server.",
"$user just joined... or did they?",
"$user just arrived. Seems OP - please nerf.",
"$user just slid into the server.",
"A $user has spawned in the server.",
"Big $user showed up!",
"Where’s $user? In the server!",
"$user hopped into the server. Kangaroo!!",
"$user just showed up. Hold my beer.",
"Challenger approaching - $user has appeared!",
"It's a bird! It's a plane! Nevermind, it's just $user.",
r"It's $user! Praise the sun! \[T]/",
"Never gonna give $user up. Never gonna let $user down.",
"$user has joined the battle bus.",
"Cheers, love! $user's here!",
"Hey! Listen! $user has joined!",
"We've been expecting you $user",
"It's dangerous to go alone, take $user!",
"$user has joined the server! It's super effective!",
"Cheers, love! $user is here!",
"$user is here, as the prophecy foretold.",
"$user has arrived. Party's over.",
"Ready player $user",
"$user is here to kick butt and chew bubblegum. And $user is all out of gum.",
"Hello. Is it $user you're looking for?",
"$user has joined. Stay a while and listen!",
"Roses are red, violets are blue, $user joined this server with you",
];
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)]
#[non_exhaustive]
pub enum OpCode {
Event = 0,
Heartbeat = 1,
Identify = 2,
StatusUpdate = 3,
VoiceStateUpdate = 4,
VoiceServerPing = 5,
Resume = 6,
Reconnect = 7,
GetGuildMembers = 8,
InvalidSession = 9,
Hello = 10,
HeartbeatAck = 11,
}
enum_number!(
OpCode {
Event,
Heartbeat,
Identify,
StatusUpdate,
VoiceStateUpdate,
VoiceServerPing,
Resume,
Reconnect,
GetGuildMembers,
InvalidSession,
Hello,
HeartbeatAck,
}
);
impl OpCode {
pub fn num(self) -> u64 {
match self {
OpCode::Event => 0,
OpCode::Heartbeat => 1,
OpCode::Identify => 2,
OpCode::StatusUpdate => 3,
OpCode::VoiceStateUpdate => 4,
OpCode::VoiceServerPing => 5,
OpCode::Resume => 6,
OpCode::Reconnect => 7,
OpCode::GetGuildMembers => 8,
OpCode::InvalidSession => 9,
OpCode::Hello => 10,
OpCode::HeartbeatAck => 11,
}
}
}
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)]
#[non_exhaustive]
pub enum VoiceOpCode {
Identify = 0,
SelectProtocol = 1,
Ready = 2,
Heartbeat = 3,
SessionDescription = 4,
Speaking = 5,
HeartbeatAck = 6,
Resume = 7,
Hello = 8,
Resumed = 9,
ClientConnect = 12,
ClientDisconnect = 13,
}
enum_number!(
VoiceOpCode {
Identify,
SelectProtocol,
Ready,
Heartbeat,
SessionDescription,
Speaking,
HeartbeatAck,
Resume,
Hello,
Resumed,
ClientConnect,
ClientDisconnect,
}
);
impl VoiceOpCode {
pub fn num(self) -> u64 {
match self {
VoiceOpCode::Identify => 0,
VoiceOpCode::SelectProtocol => 1,
VoiceOpCode::Ready => 2,
VoiceOpCode::Heartbeat => 3,
VoiceOpCode::SessionDescription => 4,
VoiceOpCode::Speaking => 5,
VoiceOpCode::HeartbeatAck => 6,
VoiceOpCode::Resume => 7,
VoiceOpCode::Hello => 8,
VoiceOpCode::Resumed => 9,
VoiceOpCode::ClientConnect => 12,
VoiceOpCode::ClientDisconnect => 13,
}
}
}
pub mod close_codes {
pub const UNKNOWN_ERROR: u16 = 4000;
pub const UNKNOWN_OPCODE: u16 = 4001;
pub const DECODE_ERROR: u16 = 4002;
pub const NOT_AUTHENTICATED: u16 = 4003;
pub const AUTHENTICATION_FAILED: u16 = 4004;
pub const ALREADY_AUTHENTICATED: u16 = 4005;
pub const INVALID_SEQUENCE: u16 = 4007;
pub const RATE_LIMITED: u16 = 4008;
pub const SESSION_TIMEOUT: u16 = 4009;
pub const INVALID_SHARD: u16 = 4010;
pub const SHARDING_REQUIRED: u16 = 4011;
pub const INVALID_GATEWAY_INTENTS: u16 = 4013;
pub const DISALLOWED_GATEWAY_INTENTS: u16 = 4014;
}