diff options
Diffstat (limited to 'protocols/Telegram/tdlib/td/td/telegram/misc.cpp')
-rw-r--r-- | protocols/Telegram/tdlib/td/td/telegram/misc.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/protocols/Telegram/tdlib/td/td/telegram/misc.cpp b/protocols/Telegram/tdlib/td/td/telegram/misc.cpp index 7983ed64a7..800ef0a4cf 100644 --- a/protocols/Telegram/tdlib/td/td/telegram/misc.cpp +++ b/protocols/Telegram/tdlib/td/td/telegram/misc.cpp @@ -1,5 +1,5 @@ // -// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2022 +// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023 // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -340,4 +340,15 @@ bool check_currency_amount(int64 amount) { return -MAX_AMOUNT <= amount && amount <= MAX_AMOUNT; } +Status validate_bot_language_code(const string &language_code) { + if (language_code.empty()) { + return Status::OK(); + } + if (language_code.size() == 2 && 'a' <= language_code[0] && language_code[0] <= 'z' && 'a' <= language_code[1] && + language_code[1] <= 'z') { + return Status::OK(); + } + return Status::Error(400, "Invalid language code specified"); +} + } // namespace td |