Update dependencies

This commit is contained in:
jude 2023-07-09 13:24:39 +01:00
parent 66f45f11f2
commit b861f6f093
8 changed files with 390 additions and 446 deletions

798
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@ edition = "2018"
[dependencies] [dependencies]
songbird = { version = "0.3", features = ["builtin-queue"] } songbird = { version = "0.3", features = ["builtin-queue"] }
poise = "0.3" poise = "0.5.5"
sqlx = { version = "0.5", default-features = false, features = ["runtime-tokio-rustls", "macros", "mysql", "bigdecimal", "migrate"] } sqlx = { version = "0.5", default-features = false, features = ["runtime-tokio-rustls", "macros", "mysql", "bigdecimal", "migrate"] }
tokio = { version = "1", features = ["fs", "process", "io-util"] } tokio = { version = "1", features = ["fs", "process", "io-util"] }
lazy_static = "1.4" lazy_static = "1.4"
@ -22,7 +22,7 @@ serde = "1.0"
dotenv = "0.15.0" dotenv = "0.15.0"
[patch."https://github.com/serenity-rs/serenity"] [patch."https://github.com/serenity-rs/serenity"]
serenity = { version = "0.11.5" } serenity = { version = "0.11.6" }
[package.metadata.deb] [package.metadata.deb]
depends = "$auto, ffmpeg" depends = "$auto, ffmpeg"

View File

@ -57,7 +57,7 @@ __Advanced Commands__
/// Get additional information about the bot /// Get additional information about the bot
#[poise::command(slash_command)] #[poise::command(slash_command)]
pub async fn info(ctx: Context<'_>) -> Result<(), Error> { pub async fn info(ctx: Context<'_>) -> Result<(), Error> {
let current_user = ctx.discord().cache.current_user(); let current_user = ctx.serenity_context().cache.current_user();
ctx.send(|m| m.ephemeral(true) ctx.send(|m| m.ephemeral(true)
.embed(|e| e .embed(|e| e

View File

@ -52,9 +52,8 @@ pub async fn upload_new_sound(
// need to check if user is patreon or nah // need to check if user is patreon or nah
if count >= *MAX_SOUNDS { if count >= *MAX_SOUNDS {
let patreon_guild_member = GuildId(*PATREON_GUILD) let patreon_guild_member =
.member(ctx.discord(), ctx.author().id) GuildId(*PATREON_GUILD).member(ctx, ctx.author().id).await;
.await;
if let Ok(member) = patreon_guild_member { if let Ok(member) = patreon_guild_member {
permit_upload = member.roles.contains(&RoleId(*PATREON_ROLE)); permit_upload = member.roles.contains(&RoleId(*PATREON_ROLE));
@ -123,8 +122,8 @@ pub async fn delete_sound(
.await?; .await?;
} else { } else {
let has_perms = { let has_perms = {
if let Ok(member) = ctx.guild_id().unwrap().member(&ctx.discord(), uid).await { if let Ok(member) = ctx.guild_id().unwrap().member(&ctx, uid).await {
if let Ok(perms) = member.permissions(&ctx.discord()) { if let Ok(perms) = member.permissions(&ctx) {
perms.manage_guild() perms.manage_guild()
} else { } else {
false false

View File

@ -31,7 +31,7 @@ pub async fn play(
} else { } else {
ctx.say( ctx.say(
play_from_query( play_from_query(
&ctx.discord(), &ctx.serenity_context(),
&ctx.data(), &ctx.data(),
guild, guild,
ctx.author().id, ctx.author().id,
@ -143,7 +143,8 @@ pub async fn queue_play(
match channel_to_join { match channel_to_join {
Some(user_channel) => { Some(user_channel) => {
let (call_handler, _) = join_channel(ctx.discord(), guild.clone(), user_channel).await; let (call_handler, _) =
join_channel(ctx.serenity_context(), guild.clone(), user_channel).await;
let guild_data = ctx let guild_data = ctx
.data() .data()
@ -232,7 +233,7 @@ pub async fn loop_play(
ctx.say( ctx.say(
play_from_query( play_from_query(
&ctx.discord(), &ctx.serenity_context(),
&ctx.data(), &ctx.data(),
guild, guild,
ctx.author().id, ctx.author().id,

View File

@ -61,9 +61,7 @@ pub async fn set_guild_greet_sound(
) -> Result<(), Error> { ) -> Result<(), Error> {
if user.id != ctx.author().id { if user.id != ctx.author().id {
let guild = ctx.guild().unwrap(); let guild = ctx.guild().unwrap();
let permissions = guild let permissions = guild.member_permissions(&ctx, ctx.author().id).await;
.member_permissions(&ctx.discord(), ctx.author().id)
.await;
if permissions.map_or(true, |p| !p.manage_guild()) { if permissions.map_or(true, |p| !p.manage_guild()) {
ctx.send(|b| { ctx.send(|b| {
@ -110,9 +108,7 @@ pub async fn unset_guild_greet_sound(
) -> Result<(), Error> { ) -> Result<(), Error> {
if user.id != ctx.author().id { if user.id != ctx.author().id {
let guild = ctx.guild().unwrap(); let guild = ctx.guild().unwrap();
let permissions = guild let permissions = guild.member_permissions(&ctx, ctx.author().id).await;
.member_permissions(&ctx.discord(), ctx.author().id)
.await;
if permissions.map_or(true, |p| !p.manage_guild()) { if permissions.map_or(true, |p| !p.manage_guild()) {
ctx.send(|b| { ctx.send(|b| {

View File

@ -10,7 +10,7 @@ use crate::{Context, Error};
guild_only = true guild_only = true
)] )]
pub async fn stop_playing(ctx: Context<'_>) -> Result<(), Error> { pub async fn stop_playing(ctx: Context<'_>) -> Result<(), Error> {
let songbird = songbird::get(ctx.discord()).await.unwrap(); let songbird = songbird::get(ctx.serenity_context()).await.unwrap();
let call_opt = songbird.get(ctx.guild_id().unwrap()); let call_opt = songbird.get(ctx.guild_id().unwrap());
if let Some(call) = call_opt { if let Some(call) = call_opt {
@ -27,7 +27,7 @@ pub async fn stop_playing(ctx: Context<'_>) -> Result<(), Error> {
/// Disconnect the bot /// Disconnect the bot
#[poise::command(slash_command, default_member_permissions = "SPEAK", guild_only = true)] #[poise::command(slash_command, default_member_permissions = "SPEAK", guild_only = true)]
pub async fn disconnect(ctx: Context<'_>) -> Result<(), Error> { pub async fn disconnect(ctx: Context<'_>) -> Result<(), Error> {
let songbird = songbird::get(ctx.discord()).await.unwrap(); let songbird = songbird::get(ctx.serenity_context()).await.unwrap();
let _ = songbird.leave(ctx.guild_id().unwrap()).await; let _ = songbird.leave(ctx.guild_id().unwrap()).await;
ctx.say("👍").await?; ctx.say("👍").await?;

View File

@ -124,7 +124,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
}, },
], ],
allowed_mentions: None, allowed_mentions: None,
listener: |ctx, event, _framework, data| Box::pin(listener(ctx, event, data)), event_handler: |ctx, event, _framework, data| Box::pin(listener(ctx, event, data)),
..Default::default() ..Default::default()
}; };
@ -136,7 +136,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
poise::Framework::builder() poise::Framework::builder()
.token(discord_token) .token(discord_token)
.user_data_setup(move |ctx, _bot, framework| { .setup(move |ctx, _bot, framework| {
Box::pin(async move { Box::pin(async move {
register_application_commands(ctx, framework, None) register_application_commands(ctx, framework, None)
.await .await