aboutsummaryrefslogtreecommitdiff
path: root/telegram/commands.go
diff options
context:
space:
mode:
authorbodqhrohro <bodqhrohro@gmail.com>2019-12-08 00:26:58 +0300
committerbodqhrohro <bodqhrohro@gmail.com>2019-12-08 00:26:58 +0300
commit58aefc5232093a75a7265c107a9e29628ff9f140 (patch)
tree4dfd2a994433f9c7fee2fb0060501b33cbfa4b97 /telegram/commands.go
parentc5996f304c04ac5b55e77a89977c5b4359eb7c85 (diff)
Add /supergroup and /channel commands
Diffstat (limited to 'telegram/commands.go')
-rw-r--r--telegram/commands.go27
1 files changed, 27 insertions, 0 deletions
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: