aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbodqhrohro <bodqhrohro@gmail.com>2019-12-08 04:54:09 +0300
committerbodqhrohro <bodqhrohro@gmail.com>2019-12-08 04:54:09 +0300
commit4679c01a994872da24d2f653d968db576b1b109a (patch)
treec2ef28189bb03e33a06bba24b9ba28146a84787e
parent5da39f4aa9201d02bbcecb4dd0319b102846d1fe (diff)
Add /block and /unblock commands
-rw-r--r--telegram/commands.go20
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: