aboutsummaryrefslogtreecommitdiff
path: root/telegram/commands.go
diff options
context:
space:
mode:
Diffstat (limited to 'telegram/commands.go')
-rw-r--r--telegram/commands.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/telegram/commands.go b/telegram/commands.go
index 44d9df8..74c2cfa 100644
--- a/telegram/commands.go
+++ b/telegram/commands.go
@@ -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 {