Skip to content

Commit

Permalink
Fix breakage due to FixedString
Browse files Browse the repository at this point in the history
  • Loading branch information
GnomedDev committed Dec 11, 2023
1 parent e1d254b commit 3689947
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 60 deletions.
102 changes: 56 additions & 46 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/feature_showcase/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ async fn is_ferris(ctx: Context<'_>) -> Result<bool, Error> {
Some(guild_id) => ctx.author().nick_in(ctx, guild_id).await,
None => None,
};
let name = nickname.as_ref().unwrap_or(&ctx.author().name);
let name = nickname.as_deref().unwrap_or(&ctx.author().name);

Ok(name.eq_ignore_ascii_case("ferris"))
}
Expand Down
2 changes: 1 addition & 1 deletion examples/feature_showcase/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub async fn boop(ctx: Context<'_>) -> Result<(), Error> {
.author_id(ctx.author().id)
.channel_id(ctx.channel_id())
.timeout(std::time::Duration::from_secs(120))
.filter(move |mci| mci.data.custom_id == uuid_boop.to_string())
.filter(move |mci| mci.data.custom_id.as_str() == uuid_boop.to_string())
.await
{
boop_count += 1;
Expand Down
2 changes: 1 addition & 1 deletion examples/feature_showcase/context_menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ pub async fn echo(
ctx: Context<'_>,
#[description = "Message to echo (enter a link or ID)"] msg: serenity::Message,
) -> Result<(), Error> {
ctx.say(&msg.content).await?;
ctx.say(msg.content).await?;
Ok(())
}
6 changes: 3 additions & 3 deletions examples/help_generation/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ async fn food_react(
#[description = "Message to react to (enter a link or ID)"] msg: serenity::Message,
) -> Result<(), Error> {
let reaction = FOOD[rand::thread_rng().gen_range(0..FOOD.len())].to_string();
msg.react(ctx, serenity::ReactionType::Unicode(reaction))
msg.react(ctx, serenity::ReactionType::Unicode(reaction.into()))
.await?;
ctx.say("Reacted!").await?;
Ok(())
Expand All @@ -258,7 +258,7 @@ async fn fruit_react(
#[description = "Message to react to (enter a link or ID)"] msg: serenity::Message,
) -> Result<(), Error> {
let reaction = FRUIT[rand::thread_rng().gen_range(0..FRUIT.len())].to_string();
msg.react(ctx, serenity::ReactionType::Unicode(reaction))
msg.react(ctx, serenity::ReactionType::Unicode(reaction.into()))
.await?;
ctx.say("Reacted!").await?;
Ok(())
Expand All @@ -276,7 +276,7 @@ async fn vegetable_react(
#[description = "Message to react to (enter a link or ID)"] msg: serenity::Message,
) -> Result<(), Error> {
let reaction = VEGETABLES[rand::thread_rng().gen_range(0..VEGETABLES.len())].to_string();
msg.react(ctx, serenity::ReactionType::Unicode(reaction))
msg.react(ctx, serenity::ReactionType::Unicode(reaction.into()))
.await?;
ctx.say("Reacted!").await?;
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion src/builtins/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ pub async fn servers<U, E>(ctx: crate::Context<'_, U, E>) -> Result<(), serenity
// Aggregate all guilds and sort them by size
let mut hidden_guilds = 0;
let mut hidden_guilds_members = 0;
let mut shown_guilds = Vec::<(String, u64)>::new();
let mut shown_guilds = Vec::new();
for guild_id in ctx.cache().guilds() {
match ctx.cache().guild(guild_id) {
Some(guild) => {
Expand Down
4 changes: 2 additions & 2 deletions src/builtins/paginate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ pub async fn paginate<U, E>(
.await
{
// Depending on which button was pressed, go to next or previous page
if press.data.custom_id == next_button_id {
if press.data.custom_id.as_str() == next_button_id {
current_page += 1;
if current_page >= pages.len() {
current_page = 0;
}
} else if press.data.custom_id == prev_button_id {
} else if press.data.custom_id.as_str() == prev_button_id {
current_page = current_page.checked_sub(1).unwrap_or(pages.len() - 1);
} else {
// This is an unrelated button interaction
Expand Down
3 changes: 2 additions & 1 deletion src/dispatch/prefix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ async fn strip_prefix<'a, U, E>(
.strip_prefix(&framework.bot_id.to_string())?
.strip_prefix('>')
})() {
let mention_prefix = &msg.content[..(msg.content.len() - stripped_content.len())];
let mention_prefix =
&msg.content[..(msg.content.len() as usize - stripped_content.len())];
return Some((mention_prefix, stripped_content));
}
}
Expand Down
Loading

0 comments on commit 3689947

Please sign in to comment.