mirror of
https://github.com/krau/SaveAny-Bot.git
synced 2026-05-11 17:19:41 +08:00
fix: handle chat ID parsing correctly by removing unnecessary prefix trimming, close #130
This commit is contained in:
@@ -14,7 +14,7 @@ import (
|
|||||||
func ParseChatID(ctx *ext.Context, idOrUsername string) (int64, error) {
|
func ParseChatID(ctx *ext.Context, idOrUsername string) (int64, error) {
|
||||||
idOrUsername = strings.TrimPrefix(idOrUsername, "@")
|
idOrUsername = strings.TrimPrefix(idOrUsername, "@")
|
||||||
if validator.IsIntStr(idOrUsername) {
|
if validator.IsIntStr(idOrUsername) {
|
||||||
chatID, err := strconv.Atoi(strings.TrimPrefix(idOrUsername, "-100"))
|
chatID, err := strconv.Atoi(idOrUsername)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user