mirror of
https://github.com/tucnak/telebot
synced 2024-11-11 01:10:39 +00:00
errors: add ErrNotStartedByUser
This commit is contained in:
parent
288a550d27
commit
e1f3fbce0c
@ -50,6 +50,7 @@ var errorRx = regexp.MustCompile(`{.+"error_code":(\d+),"description":"(.+)"}`)
|
|||||||
var (
|
var (
|
||||||
// General errors
|
// General errors
|
||||||
ErrUnauthorized = NewAPIError(401, "Unauthorized")
|
ErrUnauthorized = NewAPIError(401, "Unauthorized")
|
||||||
|
ErrNotStartedByUser = NewAPIError(403, "Forbidden: bot can't initiate conversation with a user")
|
||||||
ErrBlockedByUser = NewAPIError(401, "Forbidden: bot was blocked by the user")
|
ErrBlockedByUser = NewAPIError(401, "Forbidden: bot was blocked by the user")
|
||||||
ErrUserIsDeactivated = NewAPIError(401, "Forbidden: user is deactivated")
|
ErrUserIsDeactivated = NewAPIError(401, "Forbidden: user is deactivated")
|
||||||
ErrNotFound = NewAPIError(404, "Not Found")
|
ErrNotFound = NewAPIError(404, "Not Found")
|
||||||
@ -97,6 +98,8 @@ func ErrByDescription(s string) error {
|
|||||||
switch s {
|
switch s {
|
||||||
case ErrUnauthorized.ʔ():
|
case ErrUnauthorized.ʔ():
|
||||||
return ErrUnauthorized
|
return ErrUnauthorized
|
||||||
|
case ErrNotStartedByUser.ʔ():
|
||||||
|
return ErrNotStartedByUser
|
||||||
case ErrNotFound.ʔ():
|
case ErrNotFound.ʔ():
|
||||||
return ErrNotFound
|
return ErrNotFound
|
||||||
case ErrUserIsDeactivated.ʔ():
|
case ErrUserIsDeactivated.ʔ():
|
||||||
|
Loading…
Reference in New Issue
Block a user