aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/07_voice/src/main.rs14
-rw-r--r--examples/08_search/src/main.rs11
2 files changed, 14 insertions, 11 deletions
diff --git a/examples/07_voice/src/main.rs b/examples/07_voice/src/main.rs
index b10b0ea..35dcedf 100644
--- a/examples/07_voice/src/main.rs
+++ b/examples/07_voice/src/main.rs
@@ -44,7 +44,7 @@ fn main() {
command!(deafen(context, message) {
let guild_id = match CACHE.read().unwrap().get_guild_channel(message.channel_id) {
- Some(channel) => channel.guild_id,
+ Some(channel) => channel.read().unwrap().guild_id,
None => {
check_msg(context.say("Groups and DMs not supported"));
@@ -90,7 +90,7 @@ command!(join(context, message, args) {
};
let guild_id = match CACHE.read().unwrap().get_guild_channel(message.channel_id) {
- Some(channel) => channel.guild_id,
+ Some(channel) => channel.read().unwrap().guild_id,
None => {
check_msg(context.say("Groups and DMs not supported"));
@@ -106,7 +106,7 @@ command!(join(context, message, args) {
command!(leave(context, message) {
let guild_id = match CACHE.read().unwrap().get_guild_channel(message.channel_id) {
- Some(channel) => channel.guild_id,
+ Some(channel) => channel.read().unwrap().guild_id,
None => {
check_msg(context.say("Groups and DMs not supported"));
@@ -128,7 +128,7 @@ command!(leave(context, message) {
command!(mute(context, message) {
let guild_id = match CACHE.read().unwrap().get_guild_channel(message.channel_id) {
- Some(channel) => channel.guild_id,
+ Some(channel) => channel.read().unwrap().guild_id,
None => {
check_msg(context.say("Groups and DMs not supported"));
@@ -177,7 +177,7 @@ command!(play(context, message, args) {
}
let guild_id = match CACHE.read().unwrap().get_guild_channel(message.channel_id) {
- Some(channel) => channel.guild_id,
+ Some(channel) => channel.read().unwrap().guild_id,
None => {
check_msg(context.say("Error finding channel info"));
@@ -207,7 +207,7 @@ command!(play(context, message, args) {
command!(undeafen(context, message) {
let guild_id = match CACHE.read().unwrap().get_guild_channel(message.channel_id) {
- Some(channel) => channel.guild_id,
+ Some(channel) => channel.read().unwrap().guild_id,
None => {
check_msg(context.say("Error finding channel info"));
@@ -226,7 +226,7 @@ command!(undeafen(context, message) {
command!(unmute(context, message) {
let guild_id = match CACHE.read().unwrap().get_guild_channel(message.channel_id) {
- Some(channel) => channel.guild_id,
+ Some(channel) => channel.read().unwrap().guild_id,
None => {
check_msg(context.say("Error finding channel info"));
diff --git a/examples/08_search/src/main.rs b/examples/08_search/src/main.rs
index 915520a..c4c9230 100644
--- a/examples/08_search/src/main.rs
+++ b/examples/08_search/src/main.rs
@@ -73,11 +73,14 @@ command!(search(context, message, args) {
},
};
- guild.channels
+ let channel_ids = guild.read().unwrap()
+ .channels
.values()
- .filter(|c| c.name.starts_with("search-"))
- .map(|c| c.id)
- .collect::<Vec<_>>()
+ .filter(|c| c.read().unwrap().name.starts_with("search-"))
+ .map(|c| c.read().unwrap().id)
+ .collect::<Vec<_>>();
+
+ channel_ids.clone()
};
let search = guild_id.search_channels(&channel_ids, |s| s