7.7: chat server telegram example

This commit is contained in:
anebz 2020-06-04 18:50:57 +02:00
parent 82e64103e0
commit 8e2f7d3685
1 changed files with 111 additions and 0 deletions

View File

@ -48,3 +48,114 @@ The key objects of the system are users, conversations and status messages.
* How do we make the server scale?
* Split the data across many servers, incresing the concern about out-of-sync data
* How do we prevent DoS attacks?
## Telegram export chat json file
Example `json` of how Telegram saves message data in a `personal chat`.
```json
{
"name": "name",
"type": "personal_chat",
"id": 123456,
"messages": [
{ // text message
"id": 234,
"type": "message",
"date": "2020-01-29T11:41:46",
"edited": "1970-01-01T01:00:00",
"from": "Username",
"from_id": 123456,
"text": "..."
},
{ // sticker
"id": 432,
"type": "message",
"date": "2020-01-29T12:14:22",
"edited": "1970-01-01T01:00:00",
"from": "Username",
"from_id": 123456,
"file": "stickers/AnimatedSticker.tgs",
"thumbnail": "stickers/AnimatedSticker.tgs_thumb.jpg",
"media_type": "sticker",
"sticker_emoji": "😄",
"text": ""
},
{ // link in text message
"id": 436093,
"type": "message",
"date": "2020-01-30T17:03:34",
"edited": "1970-01-01T01:00:00",
"from": "ane",
"from_id": 222,
"text": [
{
"type": "link",
"text": "https://www.link.com"
}
]
},
{ // photo message
"id": 436396,
"type": "message",
"date": "2020-02-02T15:56:06",
"edited": "1970-01-01T01:00:00",
"from": "Username",
"from_id": 123456,
"photo": "photos/photo.jpg",
"width": 648,
"height": 259,
"text": ""
},
{ // audio message
"id": 36057,
"type": "message",
"date": "2016-04-05T13:26:02",
"edited": "1970-01-01T01:00:00",
"from": "Username",
"from_id": 123456,
"file": "voice_messages/audio_1@05-04-2016_13-26-02.ogg",
"media_type": "voice_message",
"mime_type": "audio/ogg",
"duration_seconds": 36,
"text": ""
}
]
}
```
`json` data in a `group chat`.
```json
{
"name": "group_name",
"type": "private_group",
"id": 111111,
"messages": [
{
"id": 35966,
"type": "service",
"date": "2016-04-04T22:35:06",
"edited": "1970-01-01T01:00:00",
"actor": "ane",
"actor_id": 222,
"action": "create_group",
"title": "group_name",
"members": [
"ane",
"Username"
],
"text": ""
},
{
"id": 35968,
"type": "message",
"date": "2016-04-04T22:39:08",
"edited": "1970-01-01T01:00:00",
"from": "Username",
"from_id": 123456,
"text": "..."
}
]
}
```