From 58aefc5232093a75a7265c107a9e29628ff9f140 Mon Sep 17 00:00:00 2001 From: bodqhrohro Date: Sat, 7 Dec 2019 23:26:58 +0200 Subject: [PATCH] Add /supergroup and /channel commands --- telegram/commands.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/telegram/commands.go b/telegram/commands.go index 2602609..f71040d 100644 --- a/telegram/commands.go +++ b/telegram/commands.go @@ -368,6 +368,33 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool) if err != nil { return err.Error(), true } + // create new supergroup + case "supergroup": + if len(args) < 1 { + return notEnoughArguments, true + } + + _, err := c.client.CreateNewSupergroupChat(&client.CreateNewSupergroupChatRequest{ + Title: args[0], + Description: strings.Join(args[1:], " "), + }) + if err != nil { + return err.Error(), true + } + // create new channel + case "channel": + if len(args) < 1 { + return notEnoughArguments, true + } + + _, err := c.client.CreateNewSupergroupChat(&client.CreateNewSupergroupChatRequest{ + Title: args[0], + Description: strings.Join(args[1:], " "), + IsChannel: true, + }) + if err != nil { + return err.Error(), true + } case "help": return helpString(helpTypeChat), true default: