Examples: Fix serenity-next cache accesses (#99)
Serenity's cache design has changed, this (finally) prevents the examples from failing to compile on CI.
This commit is contained in:
@@ -74,7 +74,7 @@ async fn main() {
|
|||||||
#[command]
|
#[command]
|
||||||
#[only_in(guilds)]
|
#[only_in(guilds)]
|
||||||
async fn deafen(ctx: &Context, msg: &Message) -> CommandResult {
|
async fn deafen(ctx: &Context, msg: &Message) -> CommandResult {
|
||||||
let guild = msg.guild(&ctx.cache).await.unwrap();
|
let guild = msg.guild(&ctx.cache).unwrap();
|
||||||
let guild_id = guild.id;
|
let guild_id = guild.id;
|
||||||
|
|
||||||
let manager = songbird::get(ctx).await
|
let manager = songbird::get(ctx).await
|
||||||
@@ -107,7 +107,7 @@ async fn deafen(ctx: &Context, msg: &Message) -> CommandResult {
|
|||||||
#[command]
|
#[command]
|
||||||
#[only_in(guilds)]
|
#[only_in(guilds)]
|
||||||
async fn join(ctx: &Context, msg: &Message) -> CommandResult {
|
async fn join(ctx: &Context, msg: &Message) -> CommandResult {
|
||||||
let guild = msg.guild(&ctx.cache).await.unwrap();
|
let guild = msg.guild(&ctx.cache).unwrap();
|
||||||
let guild_id = guild.id;
|
let guild_id = guild.id;
|
||||||
|
|
||||||
let channel_id = guild
|
let channel_id = guild
|
||||||
@@ -134,7 +134,7 @@ async fn join(ctx: &Context, msg: &Message) -> CommandResult {
|
|||||||
#[command]
|
#[command]
|
||||||
#[only_in(guilds)]
|
#[only_in(guilds)]
|
||||||
async fn leave(ctx: &Context, msg: &Message) -> CommandResult {
|
async fn leave(ctx: &Context, msg: &Message) -> CommandResult {
|
||||||
let guild = msg.guild(&ctx.cache).await.unwrap();
|
let guild = msg.guild(&ctx.cache).unwrap();
|
||||||
let guild_id = guild.id;
|
let guild_id = guild.id;
|
||||||
|
|
||||||
let manager = songbird::get(ctx).await
|
let manager = songbird::get(ctx).await
|
||||||
@@ -157,7 +157,7 @@ async fn leave(ctx: &Context, msg: &Message) -> CommandResult {
|
|||||||
#[command]
|
#[command]
|
||||||
#[only_in(guilds)]
|
#[only_in(guilds)]
|
||||||
async fn mute(ctx: &Context, msg: &Message) -> CommandResult {
|
async fn mute(ctx: &Context, msg: &Message) -> CommandResult {
|
||||||
let guild = msg.guild(&ctx.cache).await.unwrap();
|
let guild = msg.guild(&ctx.cache).unwrap();
|
||||||
let guild_id = guild.id;
|
let guild_id = guild.id;
|
||||||
|
|
||||||
let manager = songbird::get(ctx).await
|
let manager = songbird::get(ctx).await
|
||||||
@@ -212,7 +212,7 @@ async fn play(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult {
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
let guild = msg.guild(&ctx.cache).await.unwrap();
|
let guild = msg.guild(&ctx.cache).unwrap();
|
||||||
let guild_id = guild.id;
|
let guild_id = guild.id;
|
||||||
|
|
||||||
let manager = songbird::get(ctx).await
|
let manager = songbird::get(ctx).await
|
||||||
@@ -245,7 +245,7 @@ async fn play(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult {
|
|||||||
#[command]
|
#[command]
|
||||||
#[only_in(guilds)]
|
#[only_in(guilds)]
|
||||||
async fn undeafen(ctx: &Context, msg: &Message) -> CommandResult {
|
async fn undeafen(ctx: &Context, msg: &Message) -> CommandResult {
|
||||||
let guild = msg.guild(&ctx.cache).await.unwrap();
|
let guild = msg.guild(&ctx.cache).unwrap();
|
||||||
let guild_id = guild.id;
|
let guild_id = guild.id;
|
||||||
|
|
||||||
let manager = songbird::get(ctx).await
|
let manager = songbird::get(ctx).await
|
||||||
@@ -268,7 +268,7 @@ async fn undeafen(ctx: &Context, msg: &Message) -> CommandResult {
|
|||||||
#[command]
|
#[command]
|
||||||
#[only_in(guilds)]
|
#[only_in(guilds)]
|
||||||
async fn unmute(ctx: &Context, msg: &Message) -> CommandResult {
|
async fn unmute(ctx: &Context, msg: &Message) -> CommandResult {
|
||||||
let guild = msg.guild(&ctx.cache).await.unwrap();
|
let guild = msg.guild(&ctx.cache).unwrap();
|
||||||
let guild_id = guild.id;
|
let guild_id = guild.id;
|
||||||
|
|
||||||
let manager = songbird::get(ctx).await
|
let manager = songbird::get(ctx).await
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ async fn main() {
|
|||||||
|
|
||||||
#[command]
|
#[command]
|
||||||
async fn deafen(ctx: &Context, msg: &Message) -> CommandResult {
|
async fn deafen(ctx: &Context, msg: &Message) -> CommandResult {
|
||||||
let guild = msg.guild(&ctx.cache).await.unwrap();
|
let guild = msg.guild(&ctx.cache).unwrap();
|
||||||
let guild_id = guild.id;
|
let guild_id = guild.id;
|
||||||
|
|
||||||
let manager = songbird::get(ctx)
|
let manager = songbird::get(ctx)
|
||||||
@@ -126,7 +126,7 @@ async fn deafen(ctx: &Context, msg: &Message) -> CommandResult {
|
|||||||
#[command]
|
#[command]
|
||||||
#[only_in(guilds)]
|
#[only_in(guilds)]
|
||||||
async fn join(ctx: &Context, msg: &Message) -> CommandResult {
|
async fn join(ctx: &Context, msg: &Message) -> CommandResult {
|
||||||
let guild = msg.guild(&ctx.cache).await.unwrap();
|
let guild = msg.guild(&ctx.cache).unwrap();
|
||||||
let guild_id = guild.id;
|
let guild_id = guild.id;
|
||||||
|
|
||||||
let channel_id = guild
|
let channel_id = guild
|
||||||
@@ -241,7 +241,7 @@ impl VoiceEventHandler for ChannelDurationNotifier {
|
|||||||
#[command]
|
#[command]
|
||||||
#[only_in(guilds)]
|
#[only_in(guilds)]
|
||||||
async fn leave(ctx: &Context, msg: &Message) -> CommandResult {
|
async fn leave(ctx: &Context, msg: &Message) -> CommandResult {
|
||||||
let guild = msg.guild(&ctx.cache).await.unwrap();
|
let guild = msg.guild(&ctx.cache).unwrap();
|
||||||
let guild_id = guild.id;
|
let guild_id = guild.id;
|
||||||
|
|
||||||
let manager = songbird::get(ctx)
|
let manager = songbird::get(ctx)
|
||||||
@@ -270,7 +270,7 @@ async fn leave(ctx: &Context, msg: &Message) -> CommandResult {
|
|||||||
#[command]
|
#[command]
|
||||||
#[only_in(guilds)]
|
#[only_in(guilds)]
|
||||||
async fn mute(ctx: &Context, msg: &Message) -> CommandResult {
|
async fn mute(ctx: &Context, msg: &Message) -> CommandResult {
|
||||||
let guild = msg.guild(&ctx.cache).await.unwrap();
|
let guild = msg.guild(&ctx.cache).unwrap();
|
||||||
let guild_id = guild.id;
|
let guild_id = guild.id;
|
||||||
|
|
||||||
let manager = songbird::get(ctx)
|
let manager = songbird::get(ctx)
|
||||||
@@ -339,7 +339,7 @@ async fn play_fade(ctx: &Context, msg: &Message, mut args: Args) -> CommandResul
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
let guild = msg.guild(&ctx.cache).await.unwrap();
|
let guild = msg.guild(&ctx.cache).unwrap();
|
||||||
let guild_id = guild.id;
|
let guild_id = guild.id;
|
||||||
|
|
||||||
let manager = songbird::get(ctx)
|
let manager = songbird::get(ctx)
|
||||||
@@ -470,7 +470,7 @@ async fn queue(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult {
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
let guild = msg.guild(&ctx.cache).await.unwrap();
|
let guild = msg.guild(&ctx.cache).unwrap();
|
||||||
let guild_id = guild.id;
|
let guild_id = guild.id;
|
||||||
|
|
||||||
let manager = songbird::get(ctx)
|
let manager = songbird::get(ctx)
|
||||||
@@ -518,7 +518,7 @@ async fn queue(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult {
|
|||||||
#[command]
|
#[command]
|
||||||
#[only_in(guilds)]
|
#[only_in(guilds)]
|
||||||
async fn skip(ctx: &Context, msg: &Message, _args: Args) -> CommandResult {
|
async fn skip(ctx: &Context, msg: &Message, _args: Args) -> CommandResult {
|
||||||
let guild = msg.guild(&ctx.cache).await.unwrap();
|
let guild = msg.guild(&ctx.cache).unwrap();
|
||||||
let guild_id = guild.id;
|
let guild_id = guild.id;
|
||||||
|
|
||||||
let manager = songbird::get(ctx)
|
let manager = songbird::get(ctx)
|
||||||
@@ -553,7 +553,7 @@ async fn skip(ctx: &Context, msg: &Message, _args: Args) -> CommandResult {
|
|||||||
#[command]
|
#[command]
|
||||||
#[only_in(guilds)]
|
#[only_in(guilds)]
|
||||||
async fn stop(ctx: &Context, msg: &Message, _args: Args) -> CommandResult {
|
async fn stop(ctx: &Context, msg: &Message, _args: Args) -> CommandResult {
|
||||||
let guild = msg.guild(&ctx.cache).await.unwrap();
|
let guild = msg.guild(&ctx.cache).unwrap();
|
||||||
let guild_id = guild.id;
|
let guild_id = guild.id;
|
||||||
|
|
||||||
let manager = songbird::get(ctx)
|
let manager = songbird::get(ctx)
|
||||||
@@ -581,7 +581,7 @@ async fn stop(ctx: &Context, msg: &Message, _args: Args) -> CommandResult {
|
|||||||
#[command]
|
#[command]
|
||||||
#[only_in(guilds)]
|
#[only_in(guilds)]
|
||||||
async fn undeafen(ctx: &Context, msg: &Message) -> CommandResult {
|
async fn undeafen(ctx: &Context, msg: &Message) -> CommandResult {
|
||||||
let guild = msg.guild(&ctx.cache).await.unwrap();
|
let guild = msg.guild(&ctx.cache).unwrap();
|
||||||
let guild_id = guild.id;
|
let guild_id = guild.id;
|
||||||
|
|
||||||
let manager = songbird::get(ctx)
|
let manager = songbird::get(ctx)
|
||||||
@@ -614,7 +614,7 @@ async fn undeafen(ctx: &Context, msg: &Message) -> CommandResult {
|
|||||||
#[command]
|
#[command]
|
||||||
#[only_in(guilds)]
|
#[only_in(guilds)]
|
||||||
async fn unmute(ctx: &Context, msg: &Message) -> CommandResult {
|
async fn unmute(ctx: &Context, msg: &Message) -> CommandResult {
|
||||||
let guild = msg.guild(&ctx.cache).await.unwrap();
|
let guild = msg.guild(&ctx.cache).unwrap();
|
||||||
let guild_id = guild.id;
|
let guild_id = guild.id;
|
||||||
let manager = songbird::get(ctx)
|
let manager = songbird::get(ctx)
|
||||||
.await
|
.await
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ async fn join(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
let guild = msg.guild(&ctx.cache).await.unwrap();
|
let guild = msg.guild(&ctx.cache).unwrap();
|
||||||
let guild_id = guild.id;
|
let guild_id = guild.id;
|
||||||
|
|
||||||
let manager = songbird::get(ctx).await
|
let manager = songbird::get(ctx).await
|
||||||
@@ -227,7 +227,7 @@ async fn join(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult {
|
|||||||
#[command]
|
#[command]
|
||||||
#[only_in(guilds)]
|
#[only_in(guilds)]
|
||||||
async fn leave(ctx: &Context, msg: &Message) -> CommandResult {
|
async fn leave(ctx: &Context, msg: &Message) -> CommandResult {
|
||||||
let guild = msg.guild(&ctx.cache).await.unwrap();
|
let guild = msg.guild(&ctx.cache).unwrap();
|
||||||
let guild_id = guild.id;
|
let guild_id = guild.id;
|
||||||
|
|
||||||
let manager = songbird::get(ctx).await
|
let manager = songbird::get(ctx).await
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ async fn main() {
|
|||||||
#[command]
|
#[command]
|
||||||
#[only_in(guilds)]
|
#[only_in(guilds)]
|
||||||
async fn deafen(ctx: &Context, msg: &Message) -> CommandResult {
|
async fn deafen(ctx: &Context, msg: &Message) -> CommandResult {
|
||||||
let guild = msg.guild(&ctx.cache).await.unwrap();
|
let guild = msg.guild(&ctx.cache).unwrap();
|
||||||
let guild_id = guild.id;
|
let guild_id = guild.id;
|
||||||
|
|
||||||
let manager = songbird::get(ctx).await
|
let manager = songbird::get(ctx).await
|
||||||
@@ -184,7 +184,7 @@ async fn deafen(ctx: &Context, msg: &Message) -> CommandResult {
|
|||||||
#[command]
|
#[command]
|
||||||
#[only_in(guilds)]
|
#[only_in(guilds)]
|
||||||
async fn join(ctx: &Context, msg: &Message) -> CommandResult {
|
async fn join(ctx: &Context, msg: &Message) -> CommandResult {
|
||||||
let guild = msg.guild(&ctx.cache).await.unwrap();
|
let guild = msg.guild(&ctx.cache).unwrap();
|
||||||
let guild_id = guild.id;
|
let guild_id = guild.id;
|
||||||
|
|
||||||
let channel_id = guild
|
let channel_id = guild
|
||||||
@@ -262,7 +262,7 @@ impl VoiceEventHandler for LoopPlaySound {
|
|||||||
#[command]
|
#[command]
|
||||||
#[only_in(guilds)]
|
#[only_in(guilds)]
|
||||||
async fn leave(ctx: &Context, msg: &Message) -> CommandResult {
|
async fn leave(ctx: &Context, msg: &Message) -> CommandResult {
|
||||||
let guild = msg.guild(&ctx.cache).await.unwrap();
|
let guild = msg.guild(&ctx.cache).unwrap();
|
||||||
let guild_id = guild.id;
|
let guild_id = guild.id;
|
||||||
|
|
||||||
let manager = songbird::get(ctx).await
|
let manager = songbird::get(ctx).await
|
||||||
@@ -285,7 +285,7 @@ async fn leave(ctx: &Context, msg: &Message) -> CommandResult {
|
|||||||
#[command]
|
#[command]
|
||||||
#[only_in(guilds)]
|
#[only_in(guilds)]
|
||||||
async fn mute(ctx: &Context, msg: &Message) -> CommandResult {
|
async fn mute(ctx: &Context, msg: &Message) -> CommandResult {
|
||||||
let guild = msg.guild(&ctx.cache).await.unwrap();
|
let guild = msg.guild(&ctx.cache).unwrap();
|
||||||
let guild_id = guild.id;
|
let guild_id = guild.id;
|
||||||
|
|
||||||
let manager = songbird::get(ctx).await
|
let manager = songbird::get(ctx).await
|
||||||
@@ -318,7 +318,7 @@ async fn mute(ctx: &Context, msg: &Message) -> CommandResult {
|
|||||||
#[command]
|
#[command]
|
||||||
#[only_in(guilds)]
|
#[only_in(guilds)]
|
||||||
async fn ting(ctx: &Context, msg: &Message, _args: Args) -> CommandResult {
|
async fn ting(ctx: &Context, msg: &Message, _args: Args) -> CommandResult {
|
||||||
let guild = msg.guild(&ctx.cache).await.unwrap();
|
let guild = msg.guild(&ctx.cache).unwrap();
|
||||||
let guild_id = guild.id;
|
let guild_id = guild.id;
|
||||||
|
|
||||||
let manager = songbird::get(ctx).await
|
let manager = songbird::get(ctx).await
|
||||||
@@ -344,7 +344,7 @@ async fn ting(ctx: &Context, msg: &Message, _args: Args) -> CommandResult {
|
|||||||
#[command]
|
#[command]
|
||||||
#[only_in(guilds)]
|
#[only_in(guilds)]
|
||||||
async fn undeafen(ctx: &Context, msg: &Message) -> CommandResult {
|
async fn undeafen(ctx: &Context, msg: &Message) -> CommandResult {
|
||||||
let guild = msg.guild(&ctx.cache).await.unwrap();
|
let guild = msg.guild(&ctx.cache).unwrap();
|
||||||
let guild_id = guild.id;
|
let guild_id = guild.id;
|
||||||
|
|
||||||
let manager = songbird::get(ctx).await
|
let manager = songbird::get(ctx).await
|
||||||
@@ -368,7 +368,7 @@ async fn undeafen(ctx: &Context, msg: &Message) -> CommandResult {
|
|||||||
#[command]
|
#[command]
|
||||||
#[only_in(guilds)]
|
#[only_in(guilds)]
|
||||||
async fn unmute(ctx: &Context, msg: &Message) -> CommandResult {
|
async fn unmute(ctx: &Context, msg: &Message) -> CommandResult {
|
||||||
let guild = msg.guild(&ctx.cache).await.unwrap();
|
let guild = msg.guild(&ctx.cache).unwrap();
|
||||||
let guild_id = guild.id;
|
let guild_id = guild.id;
|
||||||
let manager = songbird::get(ctx).await
|
let manager = songbird::get(ctx).await
|
||||||
.expect("Songbird Voice client placed in at initialisation.").clone();
|
.expect("Songbird Voice client placed in at initialisation.").clone();
|
||||||
|
|||||||
Reference in New Issue
Block a user