Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into merge-upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
giuseppeM99 committed Feb 1, 2022
2 parents fd714cd + c57b04c commit f2e7e45
Show file tree
Hide file tree
Showing 18 changed files with 620 additions and 407 deletions.
42 changes: 34 additions & 8 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@ Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignArrayOfStructures: None
AlignConsecutiveMacros: None
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Left
AlignOperands: true
AlignOperands: Align
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: None # All
AllowShortIfStatementsOnASingleLine: Never # WithoutElse
AllowShortLambdasOnASingleLine: Inline # All
Expand All @@ -24,10 +27,11 @@ AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BitFieldColonSpacing: Both
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
Expand All @@ -37,12 +41,15 @@ BraceWrapping:
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeConceptDeclarations: true
BreakBeforeInheritanceComma: true # false
BreakInheritanceList: BeforeComma # BeforeColon
BreakBeforeTernaryOperators: true
Expand All @@ -60,21 +67,30 @@ Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: true
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- Q_FOREACH_THIS_LIST_MUST_BE_NON_EMPTY
IncludeBlocks: Preserve
#IndentCaseBlocks: false
IncludeCategories:
- Regex: '.*'
Priority: 0
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: true
IndentExternBlock: AfterExternBlock
IndentGotoLabels: true
IndentPPDirectives: None
IndentRequires: false
IndentWidth: 2
IndentWrappedFunctionNames: false
# InsertTrailingCommas: None
# JavaScriptQuotes: Leave
# JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
LambdaBodyIndentation: Signature
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
Expand All @@ -91,15 +107,22 @@ PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Right
PPIndentWidth: -1
ReferenceAlignment: Pointer
ReflowComments: false # true
SortIncludes: false # disabled, because we need case insensitive sort
ShortNamespaceLines: 0 # 1
SortIncludes: CaseInsensitive # CaseSensitive
# SortJavaStaticImport: Before
SortUsingDeclarations: false # true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
Expand All @@ -109,10 +132,13 @@ SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInAngles: Never
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: 1 # -1
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if (POLICY CMP0065)
cmake_policy(SET CMP0065 NEW)
endif()

project(TelegramBotApi VERSION 5.5.1 LANGUAGES CXX)
project(TelegramBotApi VERSION 5.7 LANGUAGES CXX)

if (POLICY CMP0069)
option(TELEGRAM_BOT_API_ENABLE_LTO "Use \"ON\" to enable Link Time Optimization.")
Expand Down
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ The maximum number of messages to be deleted in a single batch is determined by
###### Returns `true`

##### Command `ping`
Send an MTProto ping message to the telegram servers.
Send an MTProto ping message to the telegram servers.
Useful to detect the delay of the bot api server.

###### Parameters
Expand Down Expand Up @@ -149,7 +149,7 @@ The bot will now receive Updates for all received media, even if a destruction t
<a name="user-mode"></a>
### User Mode

You can allow user accounts to access the bot api with the command-line option `--allow-users` or set the env variable
You can allow user accounts to access the bot api with the command-line option `--allow-users` or set the env variable
`TELEGRAM_ALLOW_USERS` to `1` when using docker. User Mode is disabled by default, so only bots can access the api.

You can now log into the bot api with user accounts to create userbots running on your account.
Expand All @@ -161,37 +161,37 @@ Note: Never send your 2fa password over a plain http connection. Make sure https

Parameters:
- `phone_number`: `string`. The phone number of your Telegram Account.

Returns your `user_token` as `string`. You can use this just like a normal bot token on the `/user` endpoint

2. Send the received code to `{api_url}/user{user_token}/authcode`

Parameters:
- `code`: `int`. The code send to you by Telegram In-App or by SMS
Will send `{"ok": true, "result": true}` on success.

Will send `{"ok": true, "result": true}` on success.

3. Optional: Send your 2fa password to `{api_url}/user{user_token}/2fapassword`

Parameters:
- `password`: `string`. Password for 2fa authentication
Will send `{"ok": true, "result": true}` on success.
4. Optional: Register the user by calling `{api_url}/user{user_token}/registerUser`.

Will send `{"ok": true, "result": true}` on success.

4. Optional: Register the user by calling `{api_url}/user{user_token}/registerUser`.

User registration is disabled by default. You can enable it with the `--allow-users-registration` command line
option or the env variable `TELEGRAM_ALLOW_USERS_REGISTRATION` set to `1` when using docker.

Parameters:
- `first_name`: `string`. First name for the new account.
- `last_name`: `string`, optional. Last name for the new account.
Will send `{"ok": true, "result": true}` on success.
You are now logged in and can use all methods like in the bot api, just replace the
`/bot{bot_token}/` in your urls with `/user{token}/`.

Will send `{"ok": true, "result": true}` on success.

You are now logged in and can use all methods like in the bot api, just replace the
`/bot{bot_token}/` in your urls with `/user{token}/`.

You only need to authenticate once, the account will stay logged in. You can use the `logOut` method to log out
or simply close the session in your account settings.

Expand Down Expand Up @@ -226,7 +226,7 @@ It is possible to have multiple user-tokens to multiple client instances on the

The simplest way to use it is with this docker command:
```bash
docker run -p 8081:8081 --env TELEGRAM_API_ID=API_ID --env TELEGRAM_API_HASH=API_HASH tdlight/tdlightbotapi
docker run -p 8081:8081 --env TELEGRAM_API_ID=API_ID --env TELEGRAM_API_HASH=API_HASH tdlight/tdlightbotapi
```

The simplest way to build `Telegram Bot API server` is to use our [Telegram Bot API server build instructions generator](https://tdlight-team.github.io/tdlight-telegram-bot-api/build.html).
Expand Down
Loading

0 comments on commit f2e7e45

Please sign in to comment.