diff options
| author | acdenisSK <[email protected]> | 2017-07-10 22:11:07 +0200 |
|---|---|---|
| committer | acdenisSK <[email protected]> | 2017-07-10 22:11:07 +0200 |
| commit | 60c33db56bb3754bb0d2196d5f48fee63adf7730 (patch) | |
| tree | d0a8dda83c9b74891866c95cc57dc65f5416d8ab /src/model/guild/guild_id.rs | |
| parent | Use a trait way of overloading the `ban` function instead of an enum (diff) | |
| download | serenity-60c33db56bb3754bb0d2196d5f48fee63adf7730.tar.xz serenity-60c33db56bb3754bb0d2196d5f48fee63adf7730.zip | |
Return an error if the reason the user provided exceeded the limit
Diffstat (limited to 'src/model/guild/guild_id.rs')
| -rw-r--r-- | src/model/guild/guild_id.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/model/guild/guild_id.rs b/src/model/guild/guild_id.rs index c2cfc3d..c707413 100644 --- a/src/model/guild/guild_id.rs +++ b/src/model/guild/guild_id.rs @@ -53,7 +53,13 @@ impl GuildId { return Err(Error::Model(ModelError::DeleteMessageDaysAmount(dmd))); } - http::ban_user(self.0, user.into().0, dmd, &*ban_options.reason()) + let reason = ban_options.reason(); + + if reason.len() > 512 { + return Err(Error::ExceededLimit); + } + + http::ban_user(self.0, user.into().0, dmd, &*reason) } /// Gets a list of the guild's bans. |