From 500733ef2351dc85a7bb33bb4753cae6dc9e7b02 Mon Sep 17 00:00:00 2001 From: Jacherr Date: Sat, 14 Sep 2024 20:26:01 +0100 Subject: [PATCH] add autocompleting to more tag commands --- assyst-core/src/command/autocomplete.rs | 4 +++- assyst-core/src/command/misc/tag.rs | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/assyst-core/src/command/autocomplete.rs b/assyst-core/src/command/autocomplete.rs index 45a6cc2..7157b81 100644 --- a/assyst-core/src/command/autocomplete.rs +++ b/assyst-core/src/command/autocomplete.rs @@ -26,7 +26,9 @@ pub async fn handle_autocomplete( let opts = match command_full_name { "cooltext create" => cooltext_options_autocomplete(), // FIXME: this unwrap needs handling properly when tags come to dms etc - "tag run" => tag_names_autocomplete(assyst.clone(), guild_id.unwrap().get()).await, + "tag run" | "tag raw" | "tag copy" | "tag info" => { + tag_names_autocomplete(assyst.clone(), guild_id.unwrap().get()).await + }, _ => { err!("Trying to autocomplete for invalid command: {command_full_name} (arg {option})"); return; diff --git a/assyst-core/src/command/misc/tag.rs b/assyst-core/src/command/misc/tag.rs index 6ed68dd..55e4340 100644 --- a/assyst-core/src/command/misc/tag.rs +++ b/assyst-core/src/command/misc/tag.rs @@ -541,7 +541,7 @@ pub async fn list(ctxt: CommandCtxt<'_>, user: Option, flags: TagListFlags examples = ["test", "script"], guild_only = true )] -pub async fn info(ctxt: CommandCtxt<'_>, name: Word) -> anyhow::Result<()> { +pub async fn info(ctxt: CommandCtxt<'_>, name: WordAutocomplete) -> anyhow::Result<()> { let Some(guild_id) = ctxt.data.guild_id else { bail!("Tag information can only be fetched in guilds.") }; @@ -576,7 +576,7 @@ pub async fn info(ctxt: CommandCtxt<'_>, name: Word) -> anyhow::Result<()> { examples = ["test", "script"], guild_only = true )] -pub async fn raw(ctxt: CommandCtxt<'_>, name: Word) -> anyhow::Result<()> { +pub async fn raw(ctxt: CommandCtxt<'_>, name: WordAutocomplete) -> anyhow::Result<()> { let Some(guild_id) = ctxt.data.guild_id else { bail!("Tag raw content can only be fetched in guilds.") }; @@ -806,7 +806,7 @@ pub async fn backup(ctxt: CommandCtxt<'_>) -> anyhow::Result<()> { examples = ["test", "script"], guild_only = true )] -pub async fn copy(ctxt: CommandCtxt<'_>, name: Word) -> anyhow::Result<()> { +pub async fn copy(ctxt: CommandCtxt<'_>, name: WordAutocomplete) -> anyhow::Result<()> { let Some(guild_id) = ctxt.data.guild_id else { bail!("Tags can only be copied from guilds.") };