aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAustin Hellyer <[email protected]>2017-01-24 21:51:17 -0800
committerAustin Hellyer <[email protected]>2017-01-25 08:00:02 -0800
commit3ca7ad92507f056054d081485f437c08505bc7e5 (patch)
tree3966cac39a9d83f7911ae1292bfb9a8d8191670a
parentFix shard immediately rebooting on handle start (diff)
downloadserenity-3ca7ad92507f056054d081485f437c08505bc7e5.tar.xz
serenity-3ca7ad92507f056054d081485f437c08505bc7e5.zip
Add guild chunking
-rw-r--r--src/client/gateway/shard.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/client/gateway/shard.rs b/src/client/gateway/shard.rs
index 6f0a22d..de1521a 100644
--- a/src/client/gateway/shard.rs
+++ b/src/client/gateway/shard.rs
@@ -518,6 +518,19 @@ impl Shard {
///
/// If the `cache` feature is enabled, the cache will automatically be
/// updated with member chunks.
+ pub fn chunk_guilds(&self, guild_ids: &[GuildId], limit: Option<u16>, query: Option<&str>) {
+ let msg = ObjectBuilder::new()
+ .insert("op", OpCode::GetGuildMembers.num())
+ .insert_object("d", |obj| obj
+ .insert_array("guild_id", |a| guild_ids.iter().fold(a, |a, s| a.push(s.0)))
+ .insert("limit", limit.unwrap_or(0))
+ .insert("query", query.unwrap_or("")))
+ .build();
+
+ let _ = self.keepalive_channel.send(GatewayStatus::SendMessage(msg));
+ }
+
+ /// Syncs the user's guilds.
pub fn sync_guilds(&self, guild_ids: &[GuildId]) {
let msg = ObjectBuilder::new()
.insert("op", OpCode::SyncGuild.num())