Add /block and /unblock commands
This commit is contained in:
parent
5da39f4aa9
commit
4679c01a99
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue