mtproto | Telegram MTProto and its proxy in Go ( golang | Proxy library
kandi X-RAY | mtproto Summary
kandi X-RAY | mtproto Summary
MTProto === Telegram MTProto and proxy (over gRPC) in Go (golang). Telegram API layer: 71.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of mtproto
mtproto Key Features
mtproto Examples and Code Snippets
Community Discussions
Trending Discussions on mtproto
QUESTION
Can't get content from method upload.getFile using inputPhotoFileLocation, getting exeption FILE_REFERENCE_EXPIRED, readed lots of forums but cant get answer I'm using MTProto client on js
...ANSWER
Answered 2022-Mar-25 at 04:06https://core.telegram.org/constructor/inputPhotoFileLocation
You must pass type
from message.media.photo.sizes
in the thumb_size
field
That is, instead of JSON.stringify(message.media.photo.sizes.find(size => size._ == 'photoSizeProgressive'))
you need to specify message.media.photo.sizes.find(size => size._ == 'photoSizeProgressive').type
QUESTION
So I heard you can create USER bots on TG, as in BOT-like bots but in USER accounts rather than BOT accounts.
I've been searching for ages, cannot find any libs related to MTProto with good documentation on how one actually goes about doing this.
I found the question: How do I use Telegram API without a bot?
however its for another language.
Please let me know if this is still possible, and if so, what libraries are useful for this - libraries that have docs preferably.
...ANSWER
Answered 2021-Jul-24 at 17:39TdLib is what you looking for!
TDLib (Telegram Database Library) is a cross-platform, fully functional Telegram client. We designed it to help third-party developers create their own custom apps using the Telegram platform.
TdLib supports multiple languages and has a JSON interface for other languages. So don't worry about your programming language.
It even abstracts whether the internet is connected or not, downloads multiple files based on priority, and so on. I strongly suggest you use TdLib.
QUESTION
I am using tensorflow decision forests. I trained my model using Python and saved the model with SavedModel format. Then for inference I am trying to load the model in C using tensorflow C_API. I found that for this task I need to load the decision forest inference.so
file from Python package.
You can use this command in Debian 10 to install Python package:
pip3 install tensorflow-decision-forests
After that in my program I load the inference.so
file using TF_LoadLibrary
. Then I load the model using TF_LoadSessionFromSavedModel
.
Here is the code
...ANSWER
Answered 2022-Feb-08 at 17:16After a long time and didn't get an answer, I asked the question in the TensorFlow's forum and get the answer.
It seems that the current version of TensorFlow
has a problem with loading decision forests with C_API. So we can use the Yggdrasil
library as discussed in the answer.
QUESTION
I'm using a pretty simple code to listen to two specific telegram input channels and copy all received messages to one target channel. I'm using Pyrogram, which implements MTProto, because I'm NOT the admin of the source channel, I'm just a reader - hence I couldnt use the regular BOT API, because my BOT wont get added to the source channels - instead, I need to rely on a User Bot API -> MTProto.
Up until now, I was using Pyrogram 1.2.9 and it worked fine until maybe 4 weeks ago.
My code is pretty simple and straightforward:
...ANSWER
Answered 2021-Dec-30 at 14:00Yes. A new setting has been added called Restrict Saving Content
(or content protection
)
Any channel owner can enable it which will prevent users from forwarding and even copying content including text.
QUESTION
there is a searchChatsNearby method in TDLib (https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1search_chats_nearby.html), because TDLib uses the MTProto protocol, there should be an analog in the protocol, but I can't find it in the scheme (https://core.telegram.org/schema/mtproto), how to understand what features of the MTProto scheme the searchChatsNearby method is implemented?
...ANSWER
Answered 2021-Nov-09 at 10:31It's contacts.getLocated, which returns both users and groups
QUESTION
Python-telegram-bot which is HTTP Telegram Bot API wrapper has telegram.ext.ConversationHandler module and its functionality is: "A handler to hold a conversation with a single user by managing four collections of other handlers."
I'm migrating from this python-telegram-bot to Telethon MTProto API. And I have this ConversationHandler
to manage conversation. How can I create any type of ConversationHandler
in Telethon.
Here is some little overview given by Telethon to migrate from python-telegram-bot. They use echobot2.py from ptb's examples. How can I migrate using this example conversationbot.py.
...ANSWER
Answered 2020-Jul-11 at 00:38You can easily create what's known as a "finite state machine" (FSM) that is able to differentiate between the different states of a conversation a user can find themselves in.
QUESTION
As I'd like to try and implement a basic TCP connection with Telegram servers (using MTProto), I started reading about the Java NIO classes. However, I got "stuck" trying to understand the point of Selector
s for a client.
A selector supports key-based, non-blocking, multiplexed I/O. In other words, selectors enable you to perform I/O through multiple channels. (Java - The complete reference)
Being that TCP messages, as a stream, are always ordered, and that I will only open a single socket connection (a single SocketChannel
), what is the point of using Selector
s? I think there is no point, am I right?
If my self-answer is right, why not using blocking I/O directly?
...ANSWER
Answered 2020-Jul-09 at 16:31NIO
is basically used on the server side to handle large scale. I'll try to explain how a typical server works.
A server has a requests queue, from which a polling thread consumes connections as a blocking dequeue
operation (In Java, the default length of the requests queue is 50. It means if you try to initiate the 51st connection while the request queue is full, you'll get ConnectionRefused
exception).
A typical blocking
implementation goes like this:
Server accepts connection and puts it on the
requests queue
.A polling
thread
consumes connections from the head of the queue and dispatches it to athread pool
. The polling thread becomes free if thethread-pool
queue is not full and continues consuming connections from thequeue
.At some point, all the threads in the thread-pool will become busy and the polling thread will get blocked while submitting more connections to the pool (as the thread-pool queue is a
blocking queue
).The
requests queue
starts filling up in the meantime. At some point, it'll get completely full and the server will no longer accept any connections.
At this point, our server just can't scale anymore. Note that the "busy" threads in the pool might not be busy at all but just blocked - say for more data on the InputStream
of the respective socket they are serving.
Now consider this design:
The polling thread consumes items from the head of the requests queue.
It puts it on a unbounded list.
Another thread continuously iterates over this list and checks if any activity has happened on the socket (read to read, ready to write, etc). If there is an activity, the
socket
is served. Note that thesesockets
operate in theNIO
mode. That is, if there is no activity, our thread won't get blocked.The polling thread continues to submit connections to the list in the meantime as the list is unbounded. It does not get blocked anywhere (except while it is waiting for a new connection on the requests queue).
In the above design, note that our scale is limited only by our system resources - namely how many connections the list
hold. The response time will take a hit as there is just one thread servicing all the connections. You CPU consumption will be pretty high due to the mindless iteration. But you will still be able to connect to the server, unlike in the previous design.
NIO
basically solves this problem by using selectors
.
QUESTION
I am writing an MTProto client, however when I send a message my connection is closed. Under what conditions might MTProto close my connection?
...ANSWER
Answered 2020-Jul-05 at 20:48MTProto servers will close your connection (under TCP at least) if they can't understand what you've sent it; messages sent that have some incorrect parameter will typically receive a reply indicating parameters were incorrect but messages whose composition is fundamentally wrong, e.g: sending the transport code with each message instead of just the first will lead to the connection being closed. Check the code that handles the transport layer for correctness against https://core.telegram.org/mtproto/transports#tcp
QUESTION
Telegram is banned in my country and i can't connect the bot to Telegram API without a VPN I wanted to run the bot with MTProto Proxy
MTProtoProxy Format : host , port , secret
My code to connect to telegram api is (with Telegram.Bot library)
...ANSWER
Answered 2020-Jan-03 at 01:30That cannot be done because Bot API uses https requests to communicate while MTProtoProxy proxies are meant for MTProto API (used by telegram clients) which is different from the Bot API.
You would need to use a normal HTTP/socks proxy in order to avoid the ban which can be found at this page https://telegrambots.github.io/book/4/proxy.html
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install mtproto
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page