diff options
-rw-r--r-- | telegram/commands.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/telegram/commands.go b/telegram/commands.go index 2847ceb..7f97a6c 100644 --- a/telegram/commands.go +++ b/telegram/commands.go @@ -75,6 +75,7 @@ var chatCommands = map[string]command{ "promote": command{"id or @username [title]", "promote user to admin in current chat"}, "leave": command{"", "leave current chat"}, "leave!": command{"", "leave current chat (for owners)"}, + "ttl": command{"", "set secret chat messages TTL before self-destroying (in seconds)"}, "close": command{"", "close current secret chat"}, "delete": command{"", "delete current chat from chat list"}, "members": command{"[query]", "search members [by optional query] in current chat (requires admin rights)"}, @@ -742,6 +743,24 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool) if err != nil { return err.Error(), true } + // set TTL + case "ttl": + var ttl int64 + var err error + if len(args) > 0 { + ttl, err = strconv.ParseInt(args[0], 10, 32) + if err != nil { + return "Invalid TTL", true + } + } + _, err = c.client.SetChatMessageTtl(&client.SetChatMessageTtlRequest{ + ChatId: chatID, + Ttl: int32(ttl), + }) + + if err != nil { + return err.Error(), true + } // close secret chat case "close": chat, _, err := c.GetContactByID(chatID, nil) |