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

查看:30
本文介绍了我可以以 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 帐户的消息很容易.您首先需要构建一个 Telegram 客户端.要开始这个检查这些两个SO Posts 用于您需要的背景(但不是在 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)

成功完成上述步骤即可获得 Telegram Network 的授权,下一步是开始侦听发送到您的电报帐户的消息.

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天全站免登陆