aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbodqhrohro <bodqhrohro@gmail.com>2019-12-08 00:08:12 +0300
committerbodqhrohro <bodqhrohro@gmail.com>2019-12-08 00:08:12 +0300
commitc5996f304c04ac5b55e77a89977c5b4359eb7c85 (patch)
treedf3dbc14ce3966a4edde6c1a6800aa962348fc3d
parentb9c07b6f1666f9db12495ae7192585c407217eef (diff)
Add /join command
-rw-r--r--telegram/commands.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/telegram/commands.go b/telegram/commands.go
index 91bc9d5..2602609 100644
--- a/telegram/commands.go
+++ b/telegram/commands.go
@@ -356,6 +356,18 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool)
gateway.SPFrom(strconv.FormatInt(chat.Id, 10)),
gateway.SPType("subscribe"),
)
+ // join https://t.me/publichat
+ case "join":
+ if len(args) < 1 {
+ return notEnoughArguments, true
+ }
+
+ _, err := c.client.JoinChatByInviteLink(&client.JoinChatByInviteLinkRequest{
+ InviteLink: args[0],
+ })
+ if err != nil {
+ return err.Error(), true
+ }
case "help":
return helpString(helpTypeChat), true
default: