aboutsummaryrefslogtreecommitdiff
path: root/telegram/commands.go
diff options
context:
space:
mode:
authorBohdan Horbeshko <bodqhrohro@gmail.com>2022-02-01 06:14:06 +0300
committerBohdan Horbeshko <bodqhrohro@gmail.com>2022-02-01 06:14:06 +0300
commit86b736ec0dda93c0a6c9e00bc90576312da4d939 (patch)
tree54d65fdc20b567c58735d6de445ba5ab595b3260 /telegram/commands.go
parentbd281385c3773002ce6130191fcaec4af6a130d1 (diff)
Add /link command to retrieve chat invite link
Diffstat (limited to 'telegram/commands.go')
-rw-r--r--telegram/commands.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/telegram/commands.go b/telegram/commands.go
index c521190..b8a9c5d 100644
--- a/telegram/commands.go
+++ b/telegram/commands.go
@@ -44,6 +44,7 @@ var chatCommands = map[string]command{
"block": command{"", "blacklist current user"},
"unblock": command{"", "unblacklist current user"},
"invite": command{"id or @username", "add user to current chat"},
+ "link": command{"", "get invite link for current chat"},
"kick": command{"id or @username", "remove user to current chat"},
"ban": command{"id or @username [hours]", "restrict @username from current chat for [hours] or forever"},
"leave": command{"", "leave current chat"},
@@ -536,6 +537,15 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool)
if err != nil {
return err.Error(), true
}
+ // get link to current chat
+ case "link":
+ link, err := c.client.CreateChatInviteLink(&client.CreateChatInviteLinkRequest{
+ ChatId: chatID,
+ })
+ if err != nil {
+ return err.Error(), true
+ }
+ return link.InviteLink, true
// kick @username from current group chat
case "kick":
if len(args) < 1 {