Add /block and /unblock commands

This commit is contained in:
bodqhrohro 2019-12-08 03:54:09 +02:00
parent 5da39f4aa9
commit 4679c01a99

View file

@ -423,6 +423,26 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool)
return err.Error(), true 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": case "help":
return helpString(helpTypeChat), true return helpString(helpTypeChat), true
default: default: