aboutsummaryrefslogtreecommitdiff
path: root/src/constants.rs
diff options
context:
space:
mode:
authorAustin Hellyer <[email protected]>2016-11-12 11:21:12 -0800
committerAustin Hellyer <[email protected]>2016-11-12 11:21:12 -0800
commite9cdc50f68ad36d78b5fcc1c0dd6463274828eca (patch)
treec6b0bd54bae9f18906a47fd85402faea5345a1cd /src/constants.rs
parentAdd delete_message_reactions + register event (diff)
downloadserenity-e9cdc50f68ad36d78b5fcc1c0dd6463274828eca.tar.xz
serenity-e9cdc50f68ad36d78b5fcc1c0dd6463274828eca.zip
Add a check for message content length
Before sending a request to Discord, ensure that a message's content on non-HTTP functions and methods meets the required length. If it exceeds the limit, then return a `Error::Client(ClientError::MessageTooLong(u64))`, containing the number of unicode code points exceeding the limit. Note that directly using the HTTP methods does not impose this limit.
Diffstat (limited to 'src/constants.rs')
-rw-r--r--src/constants.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/constants.rs b/src/constants.rs
index 7f71f5b..262dffd 100644
--- a/src/constants.rs
+++ b/src/constants.rs
@@ -3,6 +3,8 @@ use ::prelude_internal::*;
/// The gateway version used by the library. The gateway URI is retrieved via
/// the REST API.
pub const GATEWAY_VERSION: u8 = 6;
+/// The maximum unicode code points allowed within a message by Discord.
+pub const MESSAGE_CODE_LIMIT: u16 = 2000;
/// The [UserAgent] sent along with every request.
///
/// [UserAgent]: ../hyper/header/struct.UserAgent.html