use #[rest] on many string arguments

This commit is contained in:
2025-02-21 15:33:05 -05:00
parent c19215113f
commit e62dfcc4c8
5 changed files with 11 additions and 4 deletions

View File

@@ -37,9 +37,10 @@ async fn autocomplete_shop<'a>(
#[poise::command(slash_command, prefix_command)] #[poise::command(slash_command, prefix_command)]
pub async fn buy(ctx: Context<'_>, pub async fn buy(ctx: Context<'_>,
count: Option<i32>,
#[autocomplete = "autocomplete_shop"] #[autocomplete = "autocomplete_shop"]
item: String, #[rest]
count: Option<i32>) -> Result<(), Error> item: String) -> Result<(), Error>
{ {
let count = count.unwrap_or(1); let count = count.unwrap_or(1);

View File

@@ -8,6 +8,7 @@ pub async fn wager(
ctx: Context<'_>, ctx: Context<'_>,
amount: String, amount: String,
#[autocomplete = "super::autocomplete_inventory"] #[autocomplete = "super::autocomplete_inventory"]
#[rest]
item: Option<String>) -> Result<(), Error> item: Option<String>) -> Result<(), Error>
{ {
let mut tx = ctx.data().database.begin().await?; let mut tx = ctx.data().database.begin().await?;

View File

@@ -15,6 +15,7 @@ use crate::common::{Data, Error, Context};
#[poise::command(prefix_command, slash_command)] #[poise::command(prefix_command, slash_command)]
async fn help(ctx: Context<'_>, async fn help(ctx: Context<'_>,
#[description = "Specific command to get help with"] #[description = "Specific command to get help with"]
#[rest]
command: Option<String>) -> Result<(), Error> command: Option<String>) -> Result<(), Error>
{ {
poise::builtins::help(ctx, command.as_deref(), poise::builtins::HelpConfiguration::default()).await?; poise::builtins::help(ctx, command.as_deref(), poise::builtins::HelpConfiguration::default()).await?;

View File

@@ -61,7 +61,11 @@ async fn autocomplete_colors<'a>(
/// Change the color of your personal role /// Change the color of your personal role
#[poise::command(slash_command, prefix_command)] #[poise::command(slash_command, prefix_command)]
pub async fn color(ctx: Context<'_>, #[autocomplete = "autocomplete_colors"] color: String) -> Result<(), Error> { pub async fn color(ctx: Context<'_>,
#[autocomplete = "autocomplete_colors"]
#[rest]
color: String) -> Result<(), Error>
{
let color = if let Some(named) = COLORS.get(color.as_str()) { let color = if let Some(named) = COLORS.get(color.as_str()) {
named.clone() named.clone()
} else { } else {

View File

@@ -5,7 +5,7 @@ use poise::serenity_prelude::EditRole;
/// Change the name of your personal role /// Change the name of your personal role
#[poise::command(slash_command, prefix_command)] #[poise::command(slash_command, prefix_command)]
pub async fn name(ctx: Context<'_>, name: String) -> Result<(), Error> { pub async fn name(ctx: Context<'_>, #[rest] name: String) -> Result<(), Error> {
let guild = if let Some(guild) = ctx.guild_id() { let guild = if let Some(guild) = ctx.guild_id() {
guild guild
} else { } else {