Add /supergroup and /channel commands
This commit is contained in:
parent
c5996f304c
commit
58aefc5232
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue