fix: some argument definitions weren't exactly how i'd like them

This commit is contained in:
Soph :3 2025-09-14 22:14:34 +03:00
parent ba43a49b9c
commit efd28daf30
2 changed files with 15 additions and 4 deletions

View file

@ -182,7 +182,7 @@ impl Command for FishCommand {
fn argument_spec(&self) -> &'static [ArgumentSpec] { fn argument_spec(&self) -> &'static [ArgumentSpec] {
&[ArgumentSpec { &[ArgumentSpec {
name: "action", name: "action",
arg_type: ArgumentType::String, arg_type: ArgumentType::Enum(&["sell"]),
required: false, required: false,
default: None, default: None,
children: &[], children: &[],
@ -198,7 +198,7 @@ impl Command for FishCommand {
mut user: User, mut user: User,
) { ) {
let action = match args.get("action") { let action = match args.get("action") {
Some(ParsedArgument::String(s)) => s.as_str(), Some(ParsedArgument::Enum(s)) => s.as_str(),
_ => "", _ => "",
}; };

View file

@ -111,12 +111,23 @@ impl Command for ShopCommand {
async fn constructed(&mut self, _: Client) {} async fn constructed(&mut self, _: Client) {}
async fn event(&mut self, _: Client, _: ClientEvent) {} async fn event(&mut self, _: Client, _: ClientEvent) {}
fn argument_spec(&self) -> &'static [ArgumentSpec] { fn argument_spec(&self) -> &'static [ArgumentSpec] {
// Static array of item IDs from SHOP_ITEMS
// This is safe because SHOP_ITEMS is 'static
&[ &[
ArgumentSpec { ArgumentSpec {
name: "item_id", name: "item_id",
arg_type: ArgumentType::String, arg_type: ArgumentType::Enum(&[
SHOP_ITEMS[0].id,
SHOP_ITEMS[1].id,
SHOP_ITEMS[2].id,
SHOP_ITEMS[3].id,
SHOP_ITEMS[4].id,
SHOP_ITEMS[5].id,
SHOP_ITEMS[6].id,
SHOP_ITEMS[7].id,
SHOP_ITEMS[8].id,
]),
required: false, required: false,
default: None, default: None,
children: &[], children: &[],