Giter Club home page Giter Club logo

tdlight-team / tdlight-telegram-bot-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tdlib/telegram-bot-api

124.0 124.0 27.0 16.33 MB

The TDLight Telegram Bot API is an actively enhanced fork of the original Bot API, featuring experimental user support, proxies, unlimited files size, and more.

Home Page: https://t.me/TDLight

License: Boost Software License 1.0

CMake 0.41% HTML 2.90% C++ 96.28% Dockerfile 0.16% Shell 0.25%
mtproto tdlib tdlight telegram telegram-api telegram-bot telegram-bot-api telegram-bots telegrambot

tdlight-telegram-bot-api's People

Contributors

a5r0n avatar andrew-ld avatar cavallium avatar davidgfnet avatar demget avatar giuseppem99 avatar harshil21 avatar knorpelsenf avatar kunoisayami avatar levlam avatar luckydonald avatar mammad900 avatar marcobuster avatar matteob99 avatar naftali100 avatar serjan-nasredin avatar smaznet avatar spontanurlaub avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tdlight-telegram-bot-api's Issues

[Feature Idea] Working with calls

It would be nice to work with calls using the bot api. Because streaming the data live would be quite complicated, I think it would be nice if you would be able to play audio (/video) files in a call and record the incoming audio (/video). That would allow a wide variety of interesting bots like a mailbox (if you don't answer the call within x seconds, it asks the user to leave a message that will then be sent into the chat as voice message), web-radio, voice assistant, alarm clocks with a real ringtone and much more

We would need to add libtgvoip to this project to support calls. Please leave your feedback.

optimize_memory minimum interval

If a bot calls optimize_memory too frequently it should return without optimizing the memory again.
A bot that calls optimize_memory too frequently can create a high CPU load.
An hardcoded minimum limit of 4 minutes is fine, since allowing the change of this limit is quite useless.

Updates for outgoing messages

Userbots usually work by reacting to outgoing messages from other clients on the same account. This is currently not possible with this API. I suggest to add a command like /setOption?name=receiveOutgoingUpdates&value=1 and a binlog database to store these client settings in JSON format. This database can then also be used if you want to receive updates for changing online statuses or drafts. Just adding new update types and sending updates for outgoing messages may not be backwards compatible, so adding this setting per client is probably the way to go.

Operation not permitted: Possible permissions issue on docker container.

Fresh install on new laptop for local dev I receive the following error when starting the container:

chown: /var/lib/telegram-bot-api: Operation not permitted

Relevant data volume is created on local OS, but container fails to start when it hits the above error. Any idea what might be wrong?

build error

i get building error on windows 10

error message:
C:\test\tdlight-telegram-bot-api\td\td\generate\tl-parser\tl-parser.c(43,10): fatal error C1083: Cannot open include fi le: 'zlib.h': No such file or directory [C:\test\tdlight-telegram-bot-api\td\td\generate\tl-parser\contrib\vs\tl-parser .vcxproj] [C:\test\tdlight-telegram-bot-api\build\td\td\generate\build_tl_parser.vcxproj]

on run
cmake --build . --target install --config Release
command

Security implications of #66

With #66 merged, I still have a few points I think we still need to address, and at least document:

I think for security reasons this one would be a quite high priority to solve:

  • How can the configuration of that be turned off for the public instances we host?

Additionally it would make sense to write

  • A section about proxy support, listing the available methods in the README.

Would be nice for those not looking at the changelog too closely.

Question about high memory usage?

Hello, i run tdlight-bot-api on my 16gb ram Ubuntu 16 server .
I have a load on my bot and the tdlight-bot-api takes for my bot 5gb of ram .
In my case i use api.telegram.org for sending messages etc, and tdlight-bot-api server for getParticipants and getChat, UserMode ;

can u add a command line option that run the td engine just for calling methods not for storing,sending updates or cache something like file_ids or users data?

Better documentation

I think we need to improve the documentation of this project. Having all the important stuff and the details together in the README is a bit messy and not clear to new users. Also, we should add more information and guides on how to build and deploy the package and be clear about the new features added to upstream.

To address this, we could use the integrated GitHub Wiki and link the pages in README but if you have another proposal please share it in comments. ๐Ÿ‘

Phone numbers are exposed in the userbot tokens

First of all it does it differently from the bots, where the id of the bot is everything in front of the colon :.

Additionally it exposes the phone number at several places which is not needed, or even a security concern.

One example is the stats page, where it now incorrectly gets listed as id of the account.
Additionally it is included in every request where probably the anonymous user id would be a perfectly fine replacement.

Implement local download from https file url

So the original Bot servers lets url uploads be handled by the actual telegram backend.

This means the self hosted version of the API in your network doesn't solve the following use cases:

  • Having the files accessible only in the local network
  • Being able to increase the size limits (5 MB max size for photos and 20 MB max for other types of content.)

The latter being the reason why I looked into self host the API, as 5 MB for images is often not enough.

Handle lost connection to telegram servers gracefully

Currently, if telegram isn't working, requests are simply left open, stalling forever.

That's not great as that means basically DDoS potential.

To Reproduce:

  1. Lauch bot api
  2. Disconnect Wifi or whatever
  3. Send a request to the Bot API.
  4. ????
  5. Boom

TTL of data cleaned inside Bot API optimize_memory (enhancement of #40)

If possible, add an hardcoded TTL of few seconds to clean only data older than a few minutes,
to avoid missing updates or missing data in new updates.

This shouldn't be configurable since this TTL, of few seconds, is made only to prevent this kind of problems, and not to ensure long-term data presence after optimize_memory.

"No file limit" not work

Hey,
I'm setup local api with docker tdlight/tdlightbotapi:latest and set TELEGRAM_NO_FILE_LIMIT env variable.
But then I try to call getFile in User Mode i getting "Bad Request: file is too big" anyway.
With TELEGRAM_LOCAL that work as expected.

I check condition code from merge request and seem here logical miss:

localMode = false // parameters_->local_mode_
noFileLimit = true // parameters_->no_file_limit_

isBigFile = true // td::max(file->expected_size_, file->local_->downloaded_size_) > MAX_DOWNLOAD_FILE_SIZE

isLimited = (!localMode || !noFileLimit) && isBigFile;

isLimited // -> true

Original

Expected:

localMode = false // parameters_->local_mode_
noFileLimit = true // parameters_->no_file_limit_

isBigFile = true // td::max(file->expected_size_, file->local_->downloaded_size_) > MAX_DOWNLOAD_FILE_SIZE

isLimited = (!localMode && !noFileLimit) && isBigFile;

isLimited // -> false

Users are always online

I remember back when using tdcli, there was a command to basically set the online status explicitly.

For driving a user account in some cases it is not desired to appear online all the time.

I know sending messages does make you come online, but for normal receiving of messages, the bot_api shouldn't make a user appear online all the time.

download file doesn't work

docker run -p 8081:8081 --env TELEGRAM_API_ID=123 --env TELEGRAM_API_HASH=xyz --env TELEGRAM_ALLOW_USERS=1 --name tdlight tdlight/tdlightbotapi

steps:
http://127.0.0.1:8081/user{token}/getuserprofilephotos?user_id=123 -> {"file_id":"xyz"}
http://127.0.0.1:8081/user{token}/getFile?file_id=xyz -> {"file_path":"photos/file_0.jpg"}
http://127.0.0.1:8081/file/user{token}/photos/file_0.jpg ->{"ok":false,"error_code":404,"description":"Not Found"}

if i attache to container by command docker exec -it tdlight /bin/ash

I can see file /var/lib/telegram-bot-api/123:xyz/photos/file_0.jpg

how to download file by file_path?

Force mmap for allocations

When running for a long time, especially when multiple instances are often restarted, TDLib seems to have a problem with allocations.
By default, glibc malloc allocates small memory allocations using sbrk() syscall, and medium to big allocations using mmap().

Managing a lot of small allocations using sbrk is problematic, since no memory can be freed except for a range on the top of the data addresses, and small allocations fragment everything underneath the freeable zone, making the allocated region bigger and bigger without the possibility to free anything.
Due to this and many other problems, sbrk and brk have been deprecated on many unix-like systems, like bsd and its forks, and the latest posix specifications removed sbrk and brk entirely (they deprecated this two calls already in the 1997 standard!).

When a bot starts, it allocates a lot of small objects (tens of millions of updates and related data), until the queue gets processed and emptied.
With brk this means that when a bot starts, a memory spike occurs, and tdlib will use X GB of memory forever until closed.
Closing sessions doesn't fix this problem since some objects will still remain on the top of the addresses, making the entire allocated memory unfreeable.

Fortunately this can be fixed on systems that use glibc (linux) by adding the following line:

mallopt(M_MMAP_THRESHOLD, 0);

A threshold of 0 will force every allocation to be made with mmap, fixing the problem permanently.
With mmap when a bot closes, or a queue decreases, the memory will be returned to the OS.

Clean Bot API memory

Currently optimize_memory only cleans tdlib memory.

If a bot calls optimize_memory, maps and vectors of bot api should be cleaned. (before or after sending optimize_memory to tdlib? idk.)

optimize_memory maximum interval

Every bot should call optimize_memory sometimes to avoid memory "leaks".

Add a parameter to force optimize_memory on all bots that didn't call it in the last X hours.
This parameter should be configurable, but it shouldn't be less than 20 minutes or more than 2 days.

Bots cleaned in this way can return answers with missing data or can lose some updates, but this is not a problem, since every bot can call it for themselves every X hours to avoid this kind of problems.

new method: unpinAllChatMessages

Implement a method that removes all the pinned messages from a group.

prototype:
chat_id: int, chat_id of the group

was already implemented...

Problems with PTB

2021-04-16 00:35:27,771 - telegram.ext.dispatcher - ERROR - No error handlers are registered, logging exception.
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/python_telegram_bot-13.4.1-py3.8.egg/telegram/ext/utils/promise.py", line 79, in run
    self._result = self.pooled_function(*self.args, **self.kwargs)
  File "/home/ubuntu/SmudgePTB13/smudge/modules/stickers.py", line 111, in kang               kang_file.download('kangsticker.png')
  File "/usr/local/lib/python3.8/dist-packages/python_telegram_bot-13.4.1-py3.8.egg/telegram/files/file.py", line 159, in download
    buf = self.bot.request.retrieve(url, timeout=timeout)
  File "/usr/local/lib/python3.8/dist-packages/python_telegram_bot-13.4.1-py3.8.egg/telegram/utils/request.py", line 373, in retrieve
    return self._request_wrapper('GET', url, **urlopen_kwargs)
  File "/usr/local/lib/python3.8/dist-packages/python_telegram_bot-13.4.1-py3.8.egg/telegram/utils/request.py", line 274, in _request_wrapper
    raise InvalidToken()
telegram.error.InvalidToken: Invalid token

I'm having trouble trying to upload an image

PTB 13.4, Python3.8.5

API in user mode receives no updates for outgoing messages

When logging in as a user, getUpdates only yields updates for incoming messages, outgoing ones are ignored. This is most likely a "remnant" of the bots-only API and I assume the same holds true for webhooks.

Without this feature, it makes creating /command-based userbots nearly impossible (as the program can't react to whatever you do in your normal Telegram application).

PosixError : Permission denied : 13 : File "user_db.binlog" can't be opened/created for reading and writing

I'm using the Docker container and after updating it I had this error at container startup.

LOG:00000000:  [ 2][t 0][1624885451.285162925][telegram-bot-api.cpp:468]Bot API 5.3 server started            
LOG:00000070:  [ 2][t 0][1624885451.286713123][ClientManager.cpp:416][!ClientManager]Loaded 0 TQueue events   
LOG:000000e0:  [ 0][t 0][1624885451.286823987][ClientManager.cpp:442][!ClientManager][&status.is_error()]Can't open user_db.binlog [PosixError : Permission denied : 13 : File "user_db.binlog" can't be opened/created for reading and writing]              
[pid 1] [time 1624885451] ------------------------

Compatibility mode

It might be useful to offer a command line flag (or per bot setting?) to have the API serve the updates conform to the standard, to make integrations with libraries as seamless as possible, and increase the drop-in ability.

Running tdlight-telegram-bot-api via corporate HTTP proxy

Is it possible to run tdlight-telegram-bot-api via corporate proxy?

Unfortunately original telegram-bot-api needs to modify source code in Client.cpp to work via proxy. You have methods proxyTypeHttp proxyTypeMtproto proxyTypeSocks5 but how use them? Docker-entrypoint show TELEGRAM_PROXY option but it related to webhooks,
In the same time tdlight-api-openapi.yaml have options /addProxy via POST. Kindly please advice what should be done? Thanks!

Update readme

Readme still have references to tdlight and memory usage

Update td submodule

Update td submodule and check if everything works with the new TDLib version.

The server periodically crashes when used in usermode.

The server periodically crashes when used in usermode.
When used without usermode this problem is not observed.
Depending on the number of clients the crash interval is different, most likely the crash is due to an incoming event.
Communication with the application via webhook, the server still crashes when the application is turned off.
With 110 clients the crash occurs within a second.
With 5 clients within 2 minutes.

The project branch built in docker master is used.
The startup is done via docker-compose with the following parameters
TELEGRAM_API_ID: ""
TELEGRAM_API_HASH: "
"
TELEGRAM_LOCAL: "1"
TELEGRAM_ALLOW_USERS: "1"
TELEGRAM_FILE_EXPIRATION_TIME: "86400"
TELEGRAM_NO_FILE_LIMIT: "1"
TELEGRAM_RELATIVE: "1"
TELEGRAM_LOGS: "/var/lib/telegram-bot-api/app.log"

Last log entries for the last 5 crashes:
LOG:030f9ea0: [ 3][t 1][1694073429.895604372][MessagesManager.cpp:30188][#7930******][!MessagesManager][&notifications] Flush pending notifications in chat -1001265217787 because of received notification settings in chat -1001265217787
LOG:030f9f90: [ 3][t 1][1694073429.895610332][MessagesManager.cpp:34299][#7930******][!MessagesManager] Search for server message 502192 in chat -1001265217787 found 0x55c8824a5aa0
LOG:030fa050: [ 3][t 1][1694073429.895621299][MessagesManager.cpp:30035][#7930******][!MessagesManager][&notifications] Trying to forcely add new message notification for server message 502192 in chat -1001265217787 silently
LOG:030fa140: [ 3][t 1][1694073429.895626544][MessagesManager.cpp:30054][#7930******][!MessagesManager][&notifications] Disable notification, because chat -1001265217787 is muted
LOG:030fa200: [ 0][t 6][1694073428.998108863][Client.cpp:2333][#7930******][!Client/7930******:Q8dyyl1ExdErQjjmXsW6y0OzNiu86kfaW0qp5nDamAg] Check Unreachable failed
[pid 1] [time 1694073430] ------------------------

LOG:05c045a0: [ 3][t 1][1694073521.501748800][Td.cpp:3973][#7914******][!Td][&td_requests] Sending update: updateHavePendingNotifications {
have_delayed_notifications = false
have_unreceived_notifications = true
}
LOG:05c04680: [ 3][t 1][1694073521.526479244][MessagesManager.cpp:30082][&notifications] Pending notifications timeout in chat -1001793475418 has expired
LOG:05c04720: [ 3][t 1][1694073521.526483535][MessagesManager.cpp:30179][#7914******][!MessagesManager][&notifications] Have no pending notifications in chat -1001793475418 to flush
LOG:05c047e0: [ 3][t 1][1694073521.533130407][MessagesManager.cpp:30082][&notifications] Pending notifications timeout in chat -1001723117571 has expired
LOG:05c04880: [ 3][t 1][1694073521.533134698][MessagesManager.cpp:30179][#7930******][!MessagesManager][&notifications] Have no pending notifications in chat -1001723117571 to flush
LOG:05c04940: [ 0][t 6][1694073520.532038211][Client.cpp:2333][#7930******][!Client/7930******:Q8dyyl1ExdErQjjmXsW6y0OzNiu86kfaW0qp5nDamAg] Check Unreachable failed
[pid 1] [time 1694073521] ------------------------

LOG:04286900: [ 3][t 1][1694073590.084875822][NetQuery.cpp:58][#7953******][!Td] [Query:[id:165412864][tl:0x4423e6c5][state:Query]]
LOG:04286990: [ 3][t 1][1694073590.084885835][NetQuery.cpp:27][#7953******][!Td][&net_query] [Query:[id:165412864][tl:0x4423e6c5][state:Query]] [state:Send to NetQueryDispatcher]
LOG:04286a50: [ 3][t 1][1694073590.084894895][NetQuery.cpp:27][#7953******][!Td][&net_query] [Query:[id:165412864][tl:0x4423e6c5][state:Query]] [state:sent to main session multi proxy DcId{2}]
LOG:04286b20: [ 0][t 5][1694073589.080402612][Client.cpp:2333][#7930******][!Client/7930******:Q8dyyl1ExdErQjjmXsW6y0OzNiu86kfaW0qp5nDamAg] Check Unreachable failed
LOG:04286bd0: [ 3][t 1][1694073590.089762687][NetQuery.cpp:27][#7953******][!SessionProxy:2:main][&net_query] [Query:[id:165412864][tl:0x4423e6c5][state:Query]] [state:SessionProxy:2:main: sent to session]
LOG:04286ca0: [ 3][t 1][1694073590.089894533][Session.cpp:376][#7953******][!Session:2:main][&net_query] Receive query [Query:[id:165412864][tl:0x4423e6c5][state:Query]]
LOG:04286d50: [ 3][t 1][1694073590.089913129][NetQuery.cpp:27][#7953******][!Session:2:main][&net_query] [Query:[id:165412864][tl:0x4423e6c5][state:Query]] [state:Session:2:main: pending]
LOG:04286e10: [ 3][t 1][1694073590.089974641][NetQuery.cpp:27][#7953******][!Session:2:main][&net_query] [Query:[id:165412864][tl:0x4423e6c5][state:Query]] [state:Session:2:main: send to an MTProto connection]
LOG:04286ef0: [ 3][t 1][1694073590.090009450][Session.cpp:1165][#7953******][!Session:2:main][&net_query] Send query to connection [Query:[id:165412864][tl:0x4423e6c5][state:Query]] [message_id:0x64f982f60dbe6354][invoke_after:{}]
[pid 1] [time 1694073590] ------------------------

LOG:01ae9690: [ 3][t 1][1694073689.371023416][Session.cpp:698][#6682******][!Session:5:main] New session 13347415510567999591 created with first message_id 7275991092077265212
LOG:01ae9750: [ 3][t 1][1694073689.371045827][Session.cpp:782][#6682******][!Session:5:main][&net_query] Ack [message_id:7275991092077265212][Query:[id:4063232][tl:0x25939651][state:Query]]
LOG:01ae9810: [ 3][t 1][1694073689.371057271][Session.cpp:782][#6682******][!Session:5:main][&net_query] Ack [message_id:7275991092077270020][Query:[id:4128768][tl:0xc4f9186b][state:Query]]
LOG:01ae98d0: [ 3][t 1][1694073689.371064186][Session.cpp:782][#6682******][!Session:5:main][&net_query] Ack [message_id:7275991092078492204][Query:[id:4194304][tl:0x16fcc2cb][state:Query]]
LOG:01ae9990: [ 3][t 1][1694073689.371070623][Session.cpp:782][#6682******][!Session:5:main][&net_query] Ack [message_id:7275991092078499140][Query:[id:4259840][tl:0xc8a0ec74][state:Query]]
LOG:01ae9a50: [ 3][t 1][1694073689.371076822][Session.cpp:782][#6682******][!Session:5:main][&net_query] Ack [message_id:7275991092078502724][Query:[id:4325376][tl:0xc8a0ec74][state:Query]]
LOG:01ae9b10: [ 3][t 1][1694073689.371082544][Session.cpp:782][#6682******][!Session:5:main][&net_query] Ack [message_id:7275991092078506468][Query:[id:4390912][tl:0xd638de89][state:Query]]
LOG:01ae9bd0: [ 3][t 1][1694073689.371088981][Session.cpp:782][#6682******][!Session:5:main][&net_query] Ack [message_id:7275991092078514636][Query:[id:4456448][tl:0x2ca51fd1][state:Query]]
LOG:01ae9c90: [ 3][t 1][1694073689.371095180][Session.cpp:782][#6682******][!Session:5:main][&net_query] Ack [message_id:7275991092078514924][Query:[id:4521984][tl:0xc0977421][state:Query]]
LOG:01ae9d50: [ 3][t 1][1694073689.371101379][Session.cpp:782][#6682******][!Session:5:main][&net_query] Ack [message_id:7275991092078519628][Query:[id:5177344][tl:0x0d91a548][state:Query]]
LOG:01ae9e10: [ 3][t 1][1694073689.371126890][UpdatesManager.cpp:949][#6682******][!Td] Receive updatesTooLong {
}
LOG:01ae9e90: [ 3][t 1][1694073689.371137380][UpdatesManager.cpp:357][#6682******][!Td][&get_difference] Skip running getDifference from updatesTooLong because it is already running
LOG:01ae9f50: [ 0][t 5][1694073688.367389917][Client.cpp:2333][#7930******][!Client/7930******:Q8dyyl1ExdErQjjmXsW6y0OzNiu86kfaW0qp5nDamAg] Check Unreachable failed
LOG:01aea000: [ 3][t 1][1694073689.380808353][Session.cpp:890][#6682******][!Session:5:main][&net_query] Return query result [Query:[id:4128768][tl:0xc4f9186b][state:Query]]
LOG:01aea0b0: [ 3][t 1][1694073689.380833864][NetQuery.h:133][#6682******][!Session:5:main][&net_query] Receive answer [Query:[id:4128768][tl:0xc4f9186b][state:Query]]
LOG:01aea160: [ 3][t 1][1694073689.380874395][NetQuery.cpp:27][#6682******][!Session:5:main][&net_query] [Query:[id:4128768][tl:0xc4f9186b][state:Result][tl:0xcc1a241e]] [state:sent to callback]
LOG:01aea230: [ 3][t 1][1694073689.381044387][ConfigManager.cpp:790][#6682******][!Recoverer][&config_recoverer] Failed to connect for 1.710166 seconds
LOG:01aea2d0: [ 3][t 1][1694073689.381103754][ConfigManager.cpp:864][#6682******][!Recoverer][&config_recoverer] Wakeup in 18.3s
LOG:01aea360: [ 3][t 1][1694073689.381123781][ConfigManager.cpp:1375][#6682******][!ConfigManager] config {
flags = 101960
date = 1694073689
expires = 1694077332
test_mode = false
this_dc = 5
dc_options = vector[19] {
dcOption {
flags = 0
id = 1
ip_address = "149.154.175.51"
port = 443
}
dcOption {
flags = 16
id = 1
ip_address = "149.154.175.50"
port = 443
}
dcOption {
flags = 1
id = 1
ip_address = "2001:0b28:f23d:f001:0000:0000:0000:000a"
port = 443
}
dcOption {
flags = 0
id = 2
ip_address = "149.154.167.51"
port = 443
}
dcOption {
flags = 16
id = 2
ip_address = "149.154.167.41"
port = 443
}
dcOption {
flags = 2
id = 2
ip_address = "149.154.167.222"
port = 443
}
dcOption {
flags = 1
id = 2
ip_address = "2001:067c:04e8:f002:0000:0000:0000:000a"
port = 443
}
dcOption {
flags = 3
id = 2
ip_address = "2001:067c:04e8:f002:0000:0000:0000:000b"
port = 443
}
dcOption {
flags = 0
id = 3
ip_address = "149.154.175.100"
port = 443
}
dcOption {
flags = 16
id = 3
ip_address = "149.154.175.100"
port = 443
}
dcOption {
flags = 1
id = 3
ip_address = "2001:0b28:f23d:f003:0000:0000:0000:000a"
port = 443
}
dcOption {
flags = 0
id = 4
ip_address = "149.154.167.91"
port = 443
}
dcOption {
flags = 16
id = 4
ip_address = "149.154.167.91"
port = 443
}
dcOption {
flags = 1
id = 4
ip_address = "2001:067c:04e8:f004:0000:0000:0000:000a"
port = 443
}
dcOption {
flags = 2
id = 4
ip_address = "149.154.165.120"
port = 443
}
dcOption {
flags = 3
id = 4
ip_address = "2001:067c:04e8:f004:0000:0000:0000:000b"
port = 443
}
dcOption {
flags = 1
id = 5
ip_address = "2001:0b28:f23f:f005:0000:0000:0000:000a"
port = 443
}
dcOption {
flags = 0
id = 5
ip_address = "91.108.56.177"
port = 443
}
dcOption {
flags = 16
id = 5
ip_address = "91.108.56.177"
port = 443
}
}
dc_txt_domain_name = "apv3.stel.com"
chat_size_max = 200
megagroup_size_max = 200000
forwarded_count_max = 100
online_update_period_ms = 210000
offline_blur_timeout_ms = 5000
offline_idle_timeout_ms = 30000
online_cloud_timeout_ms = 300000
notify_cloud_delay_ms = 30000
notify_default_delay_ms = 1500
push_chat_period_ms = 60000
push_chat_limit = 2
edit_time_limit = 172800
revoke_time_limit = 2147483647
revoke_pm_time_limit = 2147483647
rating_e_decay = 2419200
stickers_recent_limit = 200
channels_read_media_period = 604800
call_receive_timeout_ms = 20000
call_ring_timeout_ms = 90000
call_connect_timeout_ms = 30000
call_packet_timeout_ms = 10000
me_url_prefix = "https://t.me/"
gif_search_username = "gif"
venue_search_username = "foursquare"
img_search_username = "bing"
caption_length_max = 1024
message_length_max = 4096
webfile_dc_id = 4
reactions_default = reactionEmoji {
emoticon = "โค"
}
autologin_token = "58KxX_UHRvb50dWdSKAUA-n4CH38mplHMOBJUlpnS0Zk-YNZFgAAAAF2La9BALCi-BUICqf7B8m08t1MAjGoNLfPnW0eTeODAnfZtxJu"
}
LOG:01aeb100: [ 3][t 1][1694073689.381343603][ConnectionCreator.cpp:1027][#6682******][!ConnectionCreator][&connections] SAVE DcOptions{[DcOption:DcId{1}[ip:149.154.175.51][port:443][secret_len:0][flags:]], [DcOption:DcId{1}[ip:149.154.175.50][port:443][secret_len:0][flags:(Static)]], [DcOption:DcId{1}[ip:2001:b28:f23d:f001::a][port:443][secret_len:0][flags:(IPv6)]], [DcOption:DcId{2}[ip:149.154.167.51][port:443][secret_len:0][flags:]], [DcOption:DcId{2}[ip:149.154.167.41][port:443][secret_len:0][flags:(Static)]], [DcOption:DcId{2}[ip:149.154.167.222][port:443][secret_len:0][flags:(MediaOnly)]], [DcOption:DcId{2}[ip:2001:67c:4e8:f002::a][port:443][secret_len:0][flags:(IPv6)]], [DcOption:DcId{2}[ip:2001:67c:4e8:f002::b][port:443][secret_len:0][flags:(MediaOnly)(IPv6)]], [DcOption:DcId{3}[ip:149.154.175.100][port:443][secret_len:0][flags:]], [DcOption:DcId{3}[ip:149.154.175.100][port:443][secret_len:0][flags:(Static)]], [DcOption:DcId{3}[ip:2001:b28:f23d:f003::a][port:443][secret_len:0][flags:(IPv6)]], [DcOption:DcId{4}[ip:149.154.167.91][port:443][secret_len:0][flags:]], [DcOption:DcId{4}[ip:149.154.167.91][port:443][secret_len:0][flags:(Static)]], [DcOption:DcId{4}[ip:2001:67c:4e8:f004::a][port:443][secret_len:0][flags:(IPv6)]], [DcOption:DcId{4}[ip:149.154.165.120][port:443][secret_len:0][flags:(MediaOnly)]], [DcOption:DcId{4}[ip:2001:67c:4e8:f004::b][port:443][secret_len:0][flags:(MediaOnly)(IPv6)]], [DcOption:DcId{5}[ip:2001:b28:f23f:f005::a][port:443][secret_len:0][flags:(IPv6)]], [DcOption:DcId{5}[ip:91.108.56.177][port:443][secret_len:0][flags:]], [DcOption:DcId{5}[ip:91.108.56.177][port:443][secret_len:0][flags:(Static)]]}
LOG:01aeb780: [ 3][t 1][1694073689.382047176][NetQueryCreator.cpp:34][#6682******][!ConfigManager] Create query help.getAppConfig {
hash = -1622216641
}
LOG:01aeb820: [ 3][t 1][1694073689.382065057][NetQuery.cpp:58][#6682******][!ConfigManager] [Query:[id:90308608][tl:0x61e3f854][state:Query]]
LOG:01aeb8b0: [ 3][t 1][1694073689.382084608][NetQuery.cpp:27][#6682******][!ConfigManager][&net_query] [Query:[id:90308608][tl:0x61e3f854][state:Query]] [state:sent to main session multi proxy DcId{5}]
[pid 1] [time 1694073689] ------------------------

LOG:097b8fd0: [ 3][t 1][1694073850.853188037][Td.cpp:3947][#7914******][!Td][&td_requests] Sending update: updateUserStatus { user_id = 1750427527 status = userStatusOnline { expires = 1694073879 } }
LOG:097b90a0: [ 3][t 1][1694073850.853278160][Session.cpp:782][#7930******][!Session:2:main][&net_query] Ack [message_id:7275991785969164824][Query:[id:306184192][tl:0xefd9a6a2][state:Query]]
LOG:097b9170: [ 3][t 1][1694073850.853290319][Session.cpp:782][#7930******][!Session:2:main][&net_query] Ack [message_id:7275991785969168712][Query:[id:306249728][tl:0x4423e6c5][state:Query]]
LOG:097b9240: [ 3][t 1][1694073850.853296995][Session.cpp:782][#7930******][!Session:2:main][&net_query] Ack [message_id:7275991785972463868][Query:[id:306315264][tl:0x12b3ad31][state:Query]]
LOG:097b9310: [ 3][t 1][1694073850.853302717][Session.cpp:782][#7930******][!Session:2:main][&net_query] Ack [message_id:7275991785973919848][Query:[id:306118656][tl:0xe470bcfd][state:Query]]
LOG:097b93e0: [ 3][t 1][1694073850.853308200][Session.cpp:782][#7930******][!Session:2:main][&net_query] Ack [message_id:7275991785973924664][Query:[id:306380800][tl:0x03173d78][state:Query]]
LOG:097b94b0: [ 3][t 1][1694073850.855612039][Td.cpp:3973][#7914******][!Td][&td_requests] Sending update: updateChatAction {
chat_id = -1001165220390
message_thread_id = 0
sender_id = messageSenderUser {
user_id = 1107580834
}
action = chatActionCancel {
}
}
LOG:097b95d0: [ 2][t 1][1694073850.889580965][Stats.h:58] CPU usage: 13.513015%
LOG:097b9630: [ 0][t 6][1694073849.886625051][Client.cpp:2333][#7930******][!Client/7930******:Q8dyyl1ExdErQjjmXsW6y0OzNiu86kfaW0qp5nDamAg] Check Unreachable failed
LOG:097b96e0: [ 3][t 1][1694073850.897499561][Session.cpp:890][#7930******][!Session:2:main][&net_query] Return query result [Query:[id:306315264][tl:0x12b3ad31][state:Query]]
LOG:097b97a0: [ 3][t 1][1694073850.897532939][NetQuery.h:133][#7930******][!Session:2:main][&net_query] Receive answer [Query:[id:306315264][tl:0x12b3ad31][state:Query]]
LOG:097b9850: [ 3][t 1][1694073850.897603511][NetQuery.cpp:27][#7930******][!Session:2:main][&net_query] [Query:[id:306315264][tl:0x12b3ad31][state:Result][tl:0xa83b0426]] [state:sent to td (no callback)]
LOG:097b9920: [ 3][t 1][1694073850.897649765][Session.cpp:992][#7930******][!Session:2:main][&net_query] Return query error [Query:[id:306249728][tl:0x4423e6c5][state:Query]]
LOG:097b99e0: [ 3][t 1][1694073850.897668123][NetQuery.h:326][#7930******][!Session:2:main][&net_query] Receive error [Query:[id:306249728][tl:0x4423e6c5][state:Query]] [Error : 420 : FLOOD_WAIT_27]
LOG:097b9ab0: [ 3][t 1][1694073850.897687196][NetQuery.cpp:27][#7930******][!Session:2:main][&net_query] [Query:[id:306249728][tl:0x4423e6c5][state:Error][Error : 420 : FLOOD_WAIT_27]] [state:sent to NetQueryDelayer]
LOG:097b9b90: [ 3][t 1][1694073850.897775888][NetQuery.cpp:27][#7930******][!Td][&net_query] [Query:[id:306315264][tl:0x12b3ad31][state:Result][tl:0xa83b0426]] [state:Td: received from DcManager]
LOG:097b9c60: [ 3][t 1][1694073850.897783756][Td.cpp:3057][#7930******][!Td][&net_query] Receive result of [Query:[id:306315264][tl:0x12b3ad31][state:Result][tl:0xa83b0426]]
LOG:097b9d10: [ 3][t 1][1694073850.897810697][MessagesManager.cpp:8362][#7930******][!Td][&notifications] Receive notification settings for chat -1001748015774 from GetDialogNotifySettingsQuery: peerNotifySettings {
flags = 4
mute_until = 2147483647
}
LOG:097b9e20: [ 3][t 1][1694073850.897838592][MessagesManager.cpp:8154][#7930******][!Td][&notifications] Update notification settings in chat -1001748015774 from [0, DefaultSound, true, false, false, false, true, true, true, true, false] to [2147483647, DefaultSound, false, false, false, false, false, true, true, true, true]
LOG:097b9f70: [ 3][t 1][1694073850.897867918][MessagesManager.cpp:37615][#7930******][!Td] Update lists of chat -1001748015774 from update_dialog_unmute_timeout
LOG:097ba020: [ 3][t 1][1694073850.897900819][MessagesManager.cpp:30188][#7930******][!MessagesManager][&notifications] Flush pending notifications in chat -1001748015774 because of received notification settings in chat -1001748015774
LOG:097ba110: [ 3][t 1][1694073850.897906541][MessagesManager.cpp:34299][#7930******][!MessagesManager] Search for server message 64995 in chat -1001748015774 found 0x555cb3663280
LOG:097ba1d0: [ 3][t 1][1694073850.897917032][MessagesManager.cpp:30035][#7930******][!MessagesManager][&notifications] Trying to forcely add new message notification for server message 64995 in chat -1001748015774 with sound
LOG:097ba2c0: [ 3][t 1][1694073850.897922515][MessagesManager.cpp:30054][#7930******][!MessagesManager][&notifications] Disable notification, because chat -1001748015774 is muted
LOG:097ba380: [ 3][t 1][1694073850.897926807][MessagesManager.cpp:34299][#7930******][!MessagesManager] Search for server message 64996 in chat -1001748015774 found 0x555cb3660100
LOG:097ba440: [ 3][t 1][1694073850.897932291][MessagesManager.cpp:30035][#7930******][!MessagesManager][&notifications] Trying to forcely add new message notification for server message 64996 in chat -1001748015774 with sound
LOG:097ba530: [ 3][t 1][1694073850.897945642][MessagesManager.cpp:30054][#7930******][!MessagesManager][&notifications] Disable notification, because chat -1001748015774 is muted
LOG:097ba5f0: [ 3][t 1][1694073850.897992134][NetQuery.cpp:27][#7930******][!NetQueryDelayer][&net_query] [Query:[id:306249728][tl:0x4423e6c5][state:Error][Error : 420 : FLOOD_WAIT_27]] [state:trying to delay]
LOG:097ba6d0: [ 3][t 1][1694073850.898001194][NetQueryDelayer.cpp:59][#7930******][!NetQueryDelayer] Set total_timeout to 27 for 306249728
LOG:097ba760: [ 3][t 1][1694073850.898005247][NetQuery.h:83][#7930******][!NetQueryDelayer][&net_query] Resend [Query:[id:306249728][tl:0x4423e6c5][state:Error]OK]
LOG:097ba810: [ 2][t 1][1694073850.898011445][NetQueryDelayer.cpp:83][#7930******][!NetQueryDelayer] Delay: [Query:[id:306249728][tl:0x4423e6c5][state:Query]] [timeout:27][total_timeout:27] because of [Error : 420 : FLOOD_WAIT_27] from Session:2:main::Connect::TCP::[149.154.167.41:443] to DcId{2} from [84.38.185.33:47496]
LOG:097ba960: [ 3][t 1][1694073850.898083925][NetQuery.cpp:27][#7930******][!NetQueryDelayer][&net_query] [Query:[id:306249728][tl:0x4423e6c5][state:Query]] [state:delay for 27.0s]
LOG:097baa20: [ 3][t 1][1694073850.898225784][Td.cpp:3973][#7930******][!Td][&td_requests] Sending update: updateChatNotificationSettings {
chat_id = -1001748015774
notification_settings = chatNotificationSettings {
use_default_mute_for = false
mute_for = 453409797
use_default_sound = true
sound_id = -1
use_default_show_preview = true
show_preview = false
use_default_disable_pinned_message_notifications = true
disable_pinned_message_notifications = false
use_default_disable_mention_notifications = true
disable_mention_notifications = false
}
}
LOG:097bac80: [ 3][t 1][1694073850.902599334][Session.cpp:890][#7930******][!Session:2:main][&net_query] Return query result [Query:[id:306184192][tl:0xefd9a6a2][state:Query]]
LOG:097bad40: [ 3][t 1][1694073850.902623414][NetQuery.h:133][#7930******][!Session:2:main][&net_query] Receive answer [Query:[id:306184192][tl:0xefd9a6a2][state:Query]]
LOG:097badf0: [ 3][t 1][1694073850.902637004][NetQuery.cpp:27][#7930******][!Session:2:main][&net_query] [Query:[id:306184192][tl:0xefd9a6a2][state:Result][tl:0x6880b94d]] [state:sent to td (no callback)]
LOG:097baec0: [ 3][t 1][1694073850.902672529][Session.cpp:890][#7930******][!Session:2:main][&net_query] Return query result [Query:[id:306380800][tl:0x03173d78][state:Query]]
LOG:097baf80: [ 3][t 1][1694073850.902673721][NetQuery.h:133][#7930******][!Session:2:main][&net_query] Receive answer [Query:[id:306380800][tl:0x03173d78][state:Query]]
LOG:097bb030: [ 3][t 1][1694073850.902676343][NetQuery.cpp:27][#7930******][!Session:2:main][&net_query] [Query:[id:306380800][tl:0x03173d78][state:Result][tl:0x3e11affb]] [state:sent to td (no callback)]
LOG:097bb100: [ 3][t 1][1694073850.902682304][NetQuery.cpp:27][#7930******][!Td][&net_query] [Query:[id:306184192][tl:0xefd9a6a2][state:Result][tl:0x6880b94d]] [state:Td: received from DcManager]
LOG:097bb1d0: [ 3][t 1][1694073850.902683496][Td.cpp:3057][#7930******][!Td][&net_query] Receive result of [Query:[id:306184192][tl:0xefd9a6a2][state:Result][tl:0x6880b94d]]
LOG:097bb280: [ 3][t 1][1694073850.902691364][NetQuery.cpp:27][#7930******][!Td][&net_query] [Query:[id:306380800][tl:0x03173d78][state:Result][tl:0x3e11affb]] [state:Td: received from DcManager]
LOG:097bb350: [ 3][t 1][1694073850.902692794][Td.cpp:3057][#7930******][!Td][&net_query] Receive result of [Query:[id:306380800][tl:0x03173d78][state:Result][tl:0x3e11affb]]
LOG:097bb400: [ 3][t 1][1694073850.902695417][MessagesManager.cpp:38701][#7930******][!Td] ----- END GET CHANNEL DIFFERENCE----- for chat -1001748015774
LOG:097bb4a0: [ 3][t 1][1694073850.902701616][MessagesManager.cpp:38732][#7930******][!Td] Receive result of getChannelDifference for chat -1001748015774 with PTS = 103952 and limit = 100 from on_channel_get_difference_timeout: updates.channelDifferenceEmpty {
flags = 3
pts = 103952
timeout = 30
}
LOG:097bb5e0: [ 3][t 1][1694073850.902705907][MessagesManager.cpp:38940][#7930******][!Td] After successful get channel difference in chat -1001748015774
[pid 1] [time 1694073850] ------------------------

Bot API instance homepage

Add a very simple non-modifiable homepage on the bot api instance that shows the link of this repository, a small description on what is it, and a link to the future wiki on how to use/download it.
Something like this:

TDLight Telegram Bot API

This is a customized instance of telegram bot apis.

To use it, take a look on our documentation: http://link-of-the-documentation

To host an instance, download the server from our repository: https://github.com/tdlight-team/tdlight-telegram-bot-api

Update GitHub "About" section

Currently, the about section reads:

About
The Telegram Bot API provides an HTTP API for creating Telegram Bots.

I would suggest the following, tdlight-focused introduction:

About
The TDLight Telegram API is an actively enhanced fork of the original Bot API, featuring experimental user support with strong focus on memory footprint and performance.

Enhance stats

Statistics can be helpful in many ways such as monitoring the instance and implement load balancers.

  • Currently, the stats format is easy to read for an human but hard to parse for a script so we need to add an option to retrieve them as JSON (with backwards compatibility).
  • @andrew-ld suggests to implement a public method to read (own) bot statistics from the public endpoint, like this: https://botapi.example.org/botID:TOKEN/getStats with a command line option or environment option to enable/disable it.

Progress tracker

  • JSON format
  • Toggle to hide sensible data
  • Per-bot public statistics
  • Documentation

Fails if TELEGRAM_STAT is not set

For me, using docker, the container fails if the TELEGRAM_STAT variable isn't set.

Maybe because the healthcheck uses it but it's not available?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.