简体   繁体   English

电报自动化

[英]Telegram Automation

I'm working on a program, it's mission is that we define some number for it (some of our mobile numbers) and it should register them in Telegram, and then gets all messages that send to that number. 我正在研究一个程序,它的任务是我们为它定义一些数字(我们的一些移动号码),它应该在Telegram中注册它们,然后获取发送到该号码的所有消息。 As you may know, the registration in Telegram needs providing a phone number and after that a validate the number by a code that is sent from Telegram. 您可能知道,Telegram中的注册需要提供电话号码,然后通过Telegram发送的代码验证号码。

I read Telegram API, but it was complex and with no certain example and explanation. 我读了Telegram API,但它很复杂,没有一定的例子和解释。 I need your help, Thanks. 我需要你的帮助,谢谢。

To implement Telegram chat, 要实现电报聊天,

  1. First of all, you should obtain your own api_id and api_hash as described here . 首先,描述你应该获得自己的api_id和api_hash 这里
  2. Read the document and get ideas about the terms used in the Protocol which will be useful to go further. 阅读文档并获得有关“协议”中使用的术语的想法,这些术语对于进一步发挥作用是有用的。
  3. Create a TCP connection with Telegram Server via port 443. 通过端口443与Telegram Server建立TCP连接。
  4. Telegram uses a key called 'Authorization Key' (ie Auth key) for Encryption/Decryption and it will be derived in both Server and Client using Diffie-Hellman Algorithm by various steps. 电报使用称为“授权密钥”(即Auth密钥)的密钥进行加密/解密,并且将通过各种步骤使用Diffie-Hellman算法在服务器和客户端中导出。 You can create this Auth key by following the steps explained here and you can also see a sample for this process here . 您可以通过以下步骤说明创建此验证关键在这里 ,你还可以看到这个过程的样品在这里
  5. When you are successfully done all steps, you will finally receive 'dh_gen_ok' response from Telegram server. 当您成功完成所有步骤后,您将最终收到来自Telegram服务器的“dh_gen_ok”响应。
  6. Now you can send RPC queries (Telegram APIs). 现在您可以发送RPC查询(Telegram API)。 The list of APIs is given in this link https://core.telegram.org/methods API列表在此链接https://core.telegram.org/methods中给出

This is just brief points which will help to give an idea about this. 这只是简单的一点,有助于对此有所了解。 To implement the whole process, you need to read the documents and get to know the flow and all its limitations. 要实现整个过程,您需要阅读文档并了解流程及其所有限制。 Hope it helps :) 希望能帮助到你 :)

Yes you can do this 是的,你可以这样做
BUT
first of all, you should write a program (class) for one number 首先,你应该为一个数字编写一个程序(类)
and after that create another instances of that class for another numbers 然后为另一个数字创建该类的另一个实例
if you write main class (work by One phoneNumber) 如果你写主类(由一个phoneNumber工作)
it's very simple to extend you program to work by many numbers 将程序扩展到许多数字的工作非常简单

Good Luck !!! 祝好运 !!!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM