我可以以json格式访问电报中的消息吗? [英] Can I access my telegram's messages as json?

查看:87
本文介绍了我可以以json格式访问电报中的消息吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试存储电报应用程序中存在的所有消息.例如,我的所有私人聊天以及所有群组的消息和频道的消息都是我的成员.

I'm trying to store all messages which are exist in my telegram application. For example all my private chats and all group's messages and channel's messages I'm a member of them.

我使用PHP编程语言.而且我需要以.json 的形式获取所有消息(而不是将其视为电报应用程序中的消息).有可能吗?

I use PHP programming language. And I need to get all messages as .json (instead of seeing them into telegram application). Is doing that possible?

基于一些研究,我发现可以通过使用 Telegram API 来实现.但是说实话,这对我来说是模糊的.我不知道该如何开始.无论如何,是否没有我想要的实现示例?还是您知道我应该如何开始?

Based on some researched, I figured out it is possible by using Telegram API. But honestly it's vague for me. I don't know how should I start. Anyway, isn't there any implemented example of what I'm looking for? Or do you know how should I start?

推荐答案

您想要实现的目标是可能的.

What you want to achieve is possible.

让我逐步介绍如何执行此操作.以下说明适用于您选择的任何语言.

Let me give you a step by step walkthrough of how to do this. The directions below will work for any language of your choice.

  1. 很容易获得对定向到电报帐户的所有消息的访问权限.您首先需要构建一个Telegram客户端.要开始使用此功能,请这些两个 SO帖子为您需要的背景(但不是PHP)

  1. It is easy to gain access to all messages that are directed to your Telegram account. You would first need to build a Telegram client. To get started on this check out these two SO Posts for the background you need (but not in PHP)

成功完成上述步骤即可获得电报网络的授权,

Successfully completing above step gets you Authorised on the Telegram Network, next step is to start listening for messages sent to your telegram account.

至此,您已经完成了基本代码设置,可以接收发送到您帐户的消息所有类型的电报消息.现在,您需要将接收到的消息转换为JSON,并可能将它们存储到您选择的任何数据库中.这一步对您来说应该很容易.

By this point you have the basic code setup to receive messages ALL types of telegram messages sent to your account. What you need now is to convert the received messages to JSON and possibly store them to any database of your choice. This step should be easy for you to do.

步骤1&上面的第2部分通过将从Telegram接收的字节转换为您可以使用所选编程语言访问的格式来完成大部分繁重的工作,此时,您只需要转换为JSON.

The steps 1 & 2 above do most of the heavy lifting for you by converting the bytes received from Telegram into a format that is accessible to you in your chosen programing language, you simply need to convert to JSON at this point.

希望这会有所帮助.

这篇关于我可以以json格式访问电报中的消息吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆