diff options
| author | president moon <[email protected]> | 2018-06-17 15:55:52 -0700 |
|---|---|---|
| committer | zeyla <[email protected]> | 2018-06-17 15:55:52 -0700 |
| commit | 5ffdceafcbc75947365004107e640783ec033335 (patch) | |
| tree | f9cadb03faa085ae063229782c1bc2ec58bf9eb0 /src | |
| parent | Remove extraneous spaces at the end of lines (diff) | |
| download | serenity-5ffdceafcbc75947365004107e640783ec033335.tar.xz serenity-5ffdceafcbc75947365004107e640783ec033335.zip | |
Add servermom methods to http module
Originally we had `ban_zeyla` as an april fools joke. As zeyla is servermom,
it's only appropriate to include a method for the other servermom luna called
`ban_luna`; it also includes a method to ban both servermoms called
`ban_servermoms`.
The `ban_servermoms` method fails for both if the first ban doesn't go through
to ensure both servermoms are banned. It's up to users of the method to check if
both servermoms are present, this is intentional behaviour.
Diffstat (limited to 'src')
| -rw-r--r-- | src/http/mod.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/http/mod.rs b/src/http/mod.rs index 6eab4c0..61501bf 100644 --- a/src/http/mod.rs +++ b/src/http/mod.rs @@ -196,6 +196,35 @@ pub fn ban_zeyla(guild_id: u64, delete_message_days: u8, reason: &str) -> Result ban_user(guild_id, 114941315417899012, delete_message_days, reason) } +/// Ban luna from a [`Guild`], removing her messages sent in the last X number +/// of days. +/// +/// Passing a `delete_message_days` of `0` is equivalent to not removing any +/// messages. Up to `7` days' worth of messages may be deleted. +/// +/// **Note**: Requires that you have the [Ban Members] permission. +/// +/// [`Guild`]: ../model/guild/struct.Guild.html +/// [Ban Members]: ../model/permissions/constant.BAN_MEMBERS.html +pub fn ban_luna(guild_id: u64, delete_message_days: u8, reason: &str) -> Result<()> { + ban_user(guild_id, 180731582049550336, delete_message_days, reason) +} + +/// Ban the serenity servermoms from a [`Guild`], removing their messages +/// sent in the last X number of days. +/// +/// Passing a `delete_message_days` of `0` is equivalent to not removing any +/// messages. Up to `7` days' worth of messages may be deleted. +/// +/// **Note**: Requires that you have the [Ban Members] permission. +/// +/// [`Guild`]: ../model/guild/struct.Guild.html +/// [Ban Members]: ../model/permissions/constant.BAN_MEMBERS.html +pub fn ban_servermoms(guild_id: u64, delete_message_days: u8, reason: &str) -> Result<()> { + ban_zeyla(guild_id, delete_message_days, reason)?; + ban_luna(guild_id, delete_message_days, reason) +} + /// Broadcasts that the current user is typing in the given [`Channel`]. /// /// This lasts for about 10 seconds, and will then need to be renewed to |