l10n and bot command auto generation; v0.6.0

This commit is contained in:
2026-02-18 11:39:20 +03:00
parent bb51a0ecb1
commit b2bda02c0f
11 changed files with 182 additions and 102 deletions

View File

@@ -67,9 +67,6 @@ func (r TelegramRequest[R, P]) DoWithContext(ctx context.Context, api *API) (R,
return zero, err
}
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
return zero, fmt.Errorf("unexpected status code: %d", res.StatusCode)
}
reader := io.LimitReader(res.Body, 10<<20)
data, err = io.ReadAll(reader)
@@ -77,6 +74,9 @@ func (r TelegramRequest[R, P]) DoWithContext(ctx context.Context, api *API) (R,
return zero, err
}
api.Logger.Debugln("RES", r.method, string(data))
if res.StatusCode != http.StatusOK {
return zero, fmt.Errorf("unexpected status code: %d", res.StatusCode)
}
var resp ApiResponse[R]
err = json.Unmarshal(data, &resp)

View File

@@ -9,7 +9,7 @@ type BotCommandScopeType string
const (
BotCommandScopeDefaultType BotCommandScopeType = "default"
BotCommandScopePrivateType BotCommandScopeType = "all_private_chats"
BotCommandScopeGroupType BotCommandScopeType = "all_groups_chats"
BotCommandScopeGroupType BotCommandScopeType = "all_group_chats"
BotCommandScopeAllChatAdministratorsType BotCommandScopeType = "all_chat_administrators"
BotCommandScopeChatType BotCommandScopeType = "chat"
BotCommandScopeChatAdministratorsType BotCommandScopeType = "chat_administrators"