Add /silent command to send messages without sound
This commit is contained in:
parent
bf00e98628
commit
6d7fb5bee4
|
@ -56,6 +56,7 @@ var transportCommands = map[string]command{
|
|||
var chatCommands = map[string]command{
|
||||
"d": command{"[n]", "delete your last message(s)"},
|
||||
"s": command{"edited message", "edit your last message"},
|
||||
"silent": command{"message", "send a message without sound"},
|
||||
"add": command{"@username", "add @username to your chat list"},
|
||||
"join": command{"https://t.me/invite_link", "join to chat via invite link"},
|
||||
"group": command{"title", "create groupchat «title» with current user"},
|
||||
|
@ -448,6 +449,28 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool)
|
|||
} else {
|
||||
return "Message processing error", true
|
||||
}
|
||||
// send without sound
|
||||
case "silent":
|
||||
if len(args) < 1 {
|
||||
return "Not enough arguments", true
|
||||
}
|
||||
|
||||
content := c.ProcessOutgoingMessage(0, rawCmdArguments(cmdline, 0), "")
|
||||
|
||||
if content != nil {
|
||||
_, err := c.client.SendMessage(&client.SendMessageRequest{
|
||||
ChatId: chatID,
|
||||
InputMessageContent: content,
|
||||
Options: &client.MessageSendOptions{
|
||||
DisableNotification: true,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return err.Error(), true
|
||||
}
|
||||
} else {
|
||||
return "Message processing error", true
|
||||
}
|
||||
// add @contact
|
||||
case "add":
|
||||
if len(args) < 1 {
|
||||
|
|
Loading…
Reference in a new issue