From 5650850be9d5554617c381ef98994f42149f282b Mon Sep 17 00:00:00 2001 From: Bohdan Horbeshko Date: Mon, 27 Oct 2025 18:21:49 -0400 Subject: [PATCH] Return text acknowledges for arbitrary commands --- telegram/commands.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/telegram/commands.go b/telegram/commands.go index f938d03..738c46b 100644 --- a/telegram/commands.go +++ b/telegram/commands.go @@ -403,6 +403,7 @@ func (c *Client) ProcessTransportCommand(cmdline string, resource string) (strin c.authorizer.Password <- args[0] } } + return "", true // sign out case "logout": _, err := c.client.LogOut() @@ -620,6 +621,7 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool, if err != nil { return err.Error(), true, false } + return "", true, true // edit message case "s": if c.me == nil { @@ -653,6 +655,7 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool, } else { return "Message processing error", true, false } + return "", true, true // send without sound case "silent": content := c.PrepareOutgoingMessageContent(rawCmdArguments(cmdline, 0)) @@ -758,6 +761,7 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool, } else { return "Message processing error", true, false } + return "", true, true // forward a message to chat case "forward": messageId, err := strconv.ParseInt(args[0], 10, 64) @@ -1140,6 +1144,7 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool, } c.sendMessagesReverse(chatID, messages.Messages) + return "", true, true // get latest entries from history case "history": var limit int32 = 10 @@ -1176,6 +1181,7 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool, } c.sendMessagesReverse(chatID, messages) + return "", true, true // chat members case "members": var query string @@ -1205,7 +1211,7 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool, return "", false, false } - return "", true, true + return "Success", true, true } func (c *Client) cmdAdd(args []string) (string, bool) { @@ -1221,7 +1227,7 @@ func (c *Client) cmdAdd(args []string) (string, bool) { c.subscribeToID(chat.Id, chat) - return "", true + return "Subscription sent", true } func (c *Client) cmdJoin(args []string) (string, bool) { @@ -1250,7 +1256,7 @@ func (c *Client) cmdJoin(args []string) (string, bool) { } } - return "", true + return "Joined", true } func (c *Client) cmdSupergroup(args []string, cmdline string) (string, bool) { @@ -1262,7 +1268,7 @@ func (c *Client) cmdSupergroup(args []string, cmdline string) (string, bool) { return err.Error(), false } - return "", true + return "Created", true } func (c *Client) cmdChannel(args []string, cmdline string) (string, bool) { @@ -1275,5 +1281,5 @@ func (c *Client) cmdChannel(args []string, cmdline string) (string, bool) { return err.Error(), false } - return "", true + return "Created", true }