Return text acknowledges for arbitrary commands

This commit is contained in:
Bohdan Horbeshko 2025-10-27 18:21:49 -04:00
parent 1d29aa4694
commit 5650850be9

View file

@ -403,6 +403,7 @@ func (c *Client) ProcessTransportCommand(cmdline string, resource string) (strin
c.authorizer.Password <- args[0] c.authorizer.Password <- args[0]
} }
} }
return "", true
// sign out // sign out
case "logout": case "logout":
_, err := c.client.LogOut() _, err := c.client.LogOut()
@ -620,6 +621,7 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool,
if err != nil { if err != nil {
return err.Error(), true, false return err.Error(), true, false
} }
return "", true, true
// edit message // edit message
case "s": case "s":
if c.me == nil { if c.me == nil {
@ -653,6 +655,7 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool,
} else { } else {
return "Message processing error", true, false return "Message processing error", true, false
} }
return "", true, true
// send without sound // send without sound
case "silent": case "silent":
content := c.PrepareOutgoingMessageContent(rawCmdArguments(cmdline, 0)) content := c.PrepareOutgoingMessageContent(rawCmdArguments(cmdline, 0))
@ -758,6 +761,7 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool,
} else { } else {
return "Message processing error", true, false return "Message processing error", true, false
} }
return "", true, true
// forward a message to chat // forward a message to chat
case "forward": case "forward":
messageId, err := strconv.ParseInt(args[0], 10, 64) 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) c.sendMessagesReverse(chatID, messages.Messages)
return "", true, true
// get latest entries from history // get latest entries from history
case "history": case "history":
var limit int32 = 10 var limit int32 = 10
@ -1176,6 +1181,7 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool,
} }
c.sendMessagesReverse(chatID, messages) c.sendMessagesReverse(chatID, messages)
return "", true, true
// chat members // chat members
case "members": case "members":
var query string var query string
@ -1205,7 +1211,7 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool,
return "", false, false return "", false, false
} }
return "", true, true return "Success", true, true
} }
func (c *Client) cmdAdd(args []string) (string, bool) { 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) c.subscribeToID(chat.Id, chat)
return "", true return "Subscription sent", true
} }
func (c *Client) cmdJoin(args []string) (string, bool) { 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) { 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 err.Error(), false
} }
return "", true return "Created", true
} }
func (c *Client) cmdChannel(args []string, cmdline string) (string, bool) { 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 err.Error(), false
} }
return "", true return "Created", true
} }