From 4679c01a994872da24d2f653d968db576b1b109a Mon Sep 17 00:00:00 2001 From: bodqhrohro Date: Sun, 8 Dec 2019 03:54:09 +0200 Subject: [PATCH] Add /block and /unblock commands --- telegram/commands.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/telegram/commands.go b/telegram/commands.go index 74406f5..b26a971 100644 --- a/telegram/commands.go +++ b/telegram/commands.go @@ -423,6 +423,26 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool) return err.Error(), true } } + // blacklists current user + case "block": + if chatID > 0 { + _, err := c.client.BlockUser(&client.BlockUserRequest{ + UserId: int32(chatID), + }) + if err != nil { + return err.Error(), true + } + } + // unblacklists current user + case "unblock": + if chatID > 0 { + _, err := c.client.UnblockUser(&client.UnblockUserRequest{ + UserId: int32(chatID), + }) + if err != nil { + return err.Error(), true + } + } case "help": return helpString(helpTypeChat), true default: