Skip to content

Commit

Permalink
Remove generics from confirm_dialog functions
Browse files Browse the repository at this point in the history
  • Loading branch information
GnomedDev committed Mar 6, 2024
1 parent 825d1c0 commit 04c4950
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions tts_commands/src/settings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ use serenity::{
};

use tts_core::{
common::{confirm_dialog, random_footer},
constants::{OPTION_SEPERATORS, PREMIUM_NEUTRAL_COLOUR},
database::{self, Compact},
common::{confirm_dialog, random_footer},
require, require_guild,
structs::{
ApplicationContext, Command, CommandResult, Context, Data, Error, Result, SpeakingRateInfo,
Expand Down Expand Up @@ -693,7 +693,7 @@ pub async fn required_role(
});

if require!(
confirm_dialog(ctx, question, ctx.gettext("Yes, I'm sure."), negative).await?,
confirm_dialog(ctx, question, ctx.gettext("Yes, I'm sure."), &negative).await?,
Ok(())
) {
ctx.data()
Expand Down
20 changes: 10 additions & 10 deletions tts_core/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub async fn dm_generic<'ctx, 'a>(
author: &serenity::User,
target: serenity::UserId,
mut target_tag: String,
attachment_url: Option<impl Into<Cow<'a, str>>>,
attachment_url: Option<&'a str>,
message: &str,
) -> Result<(String, serenity::Embed)> {
let dm_channel = target.create_dm_channel(ctx).await?;
Expand Down Expand Up @@ -403,10 +403,10 @@ pub fn clean_msg(
content
}

pub fn confirm_dialog_components<'ctx>(
positive: impl Into<Cow<'ctx, str>>,
negative: impl Into<Cow<'ctx, str>>,
) -> Cow<'ctx, [CreateActionRow<'ctx>]> {
pub fn confirm_dialog_components<'a>(
positive: &'a str,
negative: &'a str,
) -> Cow<'a, [CreateActionRow<'a>]> {
Cow::Owned(vec![CreateActionRow::Buttons(vec![
CreateButton::new("True")
.style(serenity::ButtonStyle::Success)
Expand Down Expand Up @@ -440,11 +440,11 @@ pub async fn confirm_dialog_wait(
}
}

pub async fn confirm_dialog<'ctx>(
ctx: Context<'ctx>,
prompt: &'ctx str,
positive: impl Into<Cow<'ctx, str>>,
negative: impl Into<Cow<'ctx, str>>,
pub async fn confirm_dialog(
ctx: Context<'_>,
prompt: &str,
positive: &str,
negative: &str,
) -> Result<Option<bool>> {
let builder = poise::CreateReply::default()
.content(prompt)
Expand Down

0 comments on commit 04c4950

Please sign in to comment.