diff options
| author | acdenisSK <[email protected]> | 2017-07-15 23:01:12 +0200 |
|---|---|---|
| committer | acdenisSK <[email protected]> | 2017-07-15 23:01:12 +0200 |
| commit | dc3a4dfafb1ee096b56c78d2506743e4012323f7 (patch) | |
| tree | 13d1423c2c7bc71f3857c26cb39c6b3078c05ca0 /src/framework/buckets.rs | |
| parent | Remove more threads with futures (diff) | |
| download | serenity-dc3a4dfafb1ee096b56c78d2506743e4012323f7.tar.xz serenity-dc3a4dfafb1ee096b56c78d2506743e4012323f7.zip | |
Implement adding checks to buckets
Don't ask about the horrendous code for this
Diffstat (limited to 'src/framework/buckets.rs')
| -rw-r--r-- | src/framework/buckets.rs | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/framework/buckets.rs b/src/framework/buckets.rs index 8fdaf37..c4b81b6 100644 --- a/src/framework/buckets.rs +++ b/src/framework/buckets.rs @@ -1,31 +1,26 @@ use chrono::Utc; use std::collections::HashMap; use std::default::Default; +use client::Context; +use model::{GuildId, ChannelId, UserId}; pub(crate) struct Ratelimit { pub delay: i64, pub limit: Option<(i64, i32)>, } +#[derive(Default)] pub(crate) struct MemberRatelimit { pub last_time: i64, pub set_time: i64, pub tickets: i32, } -impl Default for MemberRatelimit { - fn default() -> Self { - MemberRatelimit { - last_time: 0, - set_time: 0, - tickets: 0, - } - } -} - pub(crate) struct Bucket { pub ratelimit: Ratelimit, pub users: HashMap<u64, MemberRatelimit>, + #[cfg(feature="cache")] + pub check: Option<Box<Fn(&mut Context, GuildId, ChannelId, UserId) -> bool + 'static>>, } impl Bucket { |