diff options
author | bodqhrohro <bodqhrohro@gmail.com> | 2019-12-08 04:54:09 +0300 |
---|---|---|
committer | bodqhrohro <bodqhrohro@gmail.com> | 2019-12-08 04:54:09 +0300 |
commit | 4679c01a994872da24d2f653d968db576b1b109a (patch) | |
tree | c2ef28189bb03e33a06bba24b9ba28146a84787e /telegram/commands.go | |
parent | 5da39f4aa9201d02bbcecb4dd0319b102846d1fe (diff) |
Add /block and /unblock commands
Diffstat (limited to 'telegram/commands.go')
-rw-r--r-- | telegram/commands.go | 20 |
1 files changed, 20 insertions, 0 deletions
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: |