diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-02 15:23:48 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-02 15:23:48 +0100 |
| commit | 4de5082f6163e8b9e9988f4676bcde3a40be3044 (patch) | |
| tree | c9acc226abeddd9004febdb3f62450362eb29720 | |
| parent | docker: bake espeak-ng data for Piper TTS (diff) | |
| download | senator-sperma-4de5082f6163e8b9e9988f4676bcde3a40be3044.tar.gz senator-sperma-4de5082f6163e8b9e9988f4676bcde3a40be3044.zip | |
say: post text as a normal message after an invisible ack
Acknowledge the interaction with a zero-width ephemeral reply, delete it,
then send the text through ChannelId::say so it lands as a normal channel
message instead of an interaction reply.
| -rw-r--r-- | src/commands/utilities.rs | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/commands/utilities.rs b/src/commands/utilities.rs index 25d4bcf..7679b14 100644 --- a/src/commands/utilities.rs +++ b/src/commands/utilities.rs | |||
| @@ -976,13 +976,21 @@ pub async fn message_download(ctx: Context<'_>, message: serenity::Message) -> R | |||
| 976 | /// Echo text to channel | 976 | /// Echo text to channel |
| 977 | #[poise::command(slash_command)] | 977 | #[poise::command(slash_command)] |
| 978 | pub async fn say(ctx: Context<'_>, #[description = "Message to send"] text: String) -> Result<()> { | 978 | pub async fn say(ctx: Context<'_>, #[description = "Message to send"] text: String) -> Result<()> { |
| 979 | ctx.say(&text).await?; | 979 | // Acknowledge the interaction with an invisible ephemeral reply, delete it, |
| 980 | ctx.send( | 980 | // then post the actual text as a normal channel message (not a reply to the |
| 981 | poise::CreateReply::default() | 981 | // command invocation). |
| 982 | .content("\u{200b}") | 982 | let ack = ctx |
| 983 | .ephemeral(true), | 983 | .send( |
| 984 | ) | 984 | poise::CreateReply::default() |
| 985 | .await?; | 985 | .content("\u{200b}") |
| 986 | .ephemeral(true), | ||
| 987 | ) | ||
| 988 | .await?; | ||
| 989 | ack.delete(ctx).await?; | ||
| 990 | |||
| 991 | ctx.channel_id() | ||
| 992 | .say(ctx.serenity_context(), &text) | ||
| 993 | .await?; | ||
| 986 | Ok(()) | 994 | Ok(()) |
| 987 | } | 995 | } |
| 988 | 996 | ||
