diff options
| author | Austin Hellyer <[email protected]> | 2016-11-22 07:57:51 -0800 |
|---|---|---|
| committer | Austin Hellyer <[email protected]> | 2016-11-22 07:57:51 -0800 |
| commit | d4726f899cf6b86d805a8a2a77ec57782ec3bdd6 (patch) | |
| tree | 7966be3c6d6c4284bb618b88b3f146dd412af677 /examples | |
| parent | Don't typo CreateEmbed::image field (diff) | |
| download | serenity-d4726f899cf6b86d805a8a2a77ec57782ec3bdd6.tar.xz serenity-d4726f899cf6b86d805a8a2a77ec57782ec3bdd6.zip | |
Rename the State to Cache
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/02_transparent_guild_sharding.rs | 6 | ||||
| -rw-r--r-- | examples/07_voice.rs | 10 |
2 files changed, 8 insertions, 8 deletions
diff --git a/examples/02_transparent_guild_sharding.rs b/examples/02_transparent_guild_sharding.rs index 64a5a6f..19b61d0 100644 --- a/examples/02_transparent_guild_sharding.rs +++ b/examples/02_transparent_guild_sharding.rs @@ -6,8 +6,8 @@ use std::env; // Serenity implements transparent sharding in a way that you do not need to // manually handle separate processes or connections manually. // -// Transparent sharding is useful for a shared state. Instead of having states -// with duplicated data, a shared state means all your data can be easily +// Transparent sharding is useful for a shared cache. Instead of having caches +// with duplicated data, a shared cache means all your data can be easily // accessible across all shards. // // If your bot is on many guilds - or over the maximum of 2500 - then you @@ -19,7 +19,7 @@ use std::env; // // Taking a scenario of 2 guilds, try saying "!ping" in one guild. It should // print either "0" or "1" in the console. Saying "!ping" in the other guild, -// it should state the other number in the console. This confirms that guild +// it should cache the other number in the console. This confirms that guild // sharding works. fn main() { // Configure the client with your Discord bot token in the environment. diff --git a/examples/07_voice.rs b/examples/07_voice.rs index e0dfd88..57337a8 100644 --- a/examples/07_voice.rs +++ b/examples/07_voice.rs @@ -3,7 +3,7 @@ extern crate serenity; #[cfg(feature = "voice")] -use serenity::client::{STATE, Client, Context}; +use serenity::client::{CACHE, Client, Context}; #[cfg(feature = "voice")] use serenity::model::{Channel, ChannelId, Message}; #[cfg(feature = "voice")] @@ -38,7 +38,7 @@ fn main() { #[cfg(feature = "voice")] fn deafen(context: Context, message: Message, _args: Vec<String>) { - let guild_id = match STATE.lock().unwrap().get_channel(message.channel_id) { + let guild_id = match CACHE.lock().unwrap().get_channel(message.channel_id) { Some(Channel::Public(channel)) => channel.guild_id, Some(_) => { let _ = message.reply("Groups and DMs not supported"); @@ -90,7 +90,7 @@ fn join(context: Context, message: Message, args: Vec<String>) { }, }; - let guild_id = match STATE.lock().unwrap().get_channel(message.channel_id) { + let guild_id = match CACHE.lock().unwrap().get_channel(message.channel_id) { Some(Channel::Public(channel)) => channel.guild_id, Some(_) => { let _ = context.say("Groups and DMs not supported"); @@ -114,7 +114,7 @@ fn join(context: Context, message: Message, args: Vec<String>) { #[cfg(feature = "voice")] fn leave(context: Context, message: Message, _args: Vec<String>) { - let guild_id = match STATE.lock().unwrap().get_channel(message.channel_id) { + let guild_id = match CACHE.lock().unwrap().get_channel(message.channel_id) { Some(Channel::Public(channel)) => channel.guild_id, Some(_) => { let _ = context.say("Groups and DMs not supported"); @@ -144,7 +144,7 @@ fn leave(context: Context, message: Message, _args: Vec<String>) { #[cfg(feature = "voice")] fn mute(context: Context, message: Message, _args: Vec<String>) { - let guild_id = match STATE.lock().unwrap().get_channel(message.channel_id) { + let guild_id = match CACHE.lock().unwrap().get_channel(message.channel_id) { Some(Channel::Public(channel)) => channel.guild_id, Some(_) => { let _ = message.reply("Groups and DMs not supported"); |