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]
}
}
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
}