opencode-telegram-mirror 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +196 -0
- package/README.md +230 -0
- package/bun.lock +67 -0
- package/package.json +27 -0
- package/src/config.ts +99 -0
- package/src/database.ts +120 -0
- package/src/diff-service.ts +176 -0
- package/src/log.ts +23 -0
- package/src/main.ts +1182 -0
- package/src/message-formatting.ts +202 -0
- package/src/opencode.ts +306 -0
- package/src/permission-handler.ts +242 -0
- package/src/question-handler.ts +391 -0
- package/src/system-message.ts +73 -0
- package/src/telegram.ts +705 -0
- package/test/fixtures/commands-test.json +157 -0
- package/test/fixtures/sample-updates.json +9098 -0
- package/test/mock-server.ts +271 -0
- package/test/run-test.ts +160 -0
- package/tsconfig.json +26 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"update_id": 100001,
|
|
4
|
+
"chat_id": "-1003546563617",
|
|
5
|
+
"payload": {
|
|
6
|
+
"update_id": 100001,
|
|
7
|
+
"message": {
|
|
8
|
+
"message_id": 1001,
|
|
9
|
+
"from": {
|
|
10
|
+
"id": 917351484,
|
|
11
|
+
"is_bot": false,
|
|
12
|
+
"first_name": "Test",
|
|
13
|
+
"username": "test_user"
|
|
14
|
+
},
|
|
15
|
+
"chat": {
|
|
16
|
+
"id": -1003546563617,
|
|
17
|
+
"title": "Test Chat",
|
|
18
|
+
"type": "supergroup"
|
|
19
|
+
},
|
|
20
|
+
"date": 1768590000,
|
|
21
|
+
"text": "/interrupt",
|
|
22
|
+
"entities": [
|
|
23
|
+
{
|
|
24
|
+
"offset": 0,
|
|
25
|
+
"length": 10,
|
|
26
|
+
"type": "bot_command"
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"received_at": 1768590000000
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"update_id": 100002,
|
|
35
|
+
"chat_id": "-1003546563617",
|
|
36
|
+
"payload": {
|
|
37
|
+
"update_id": 100002,
|
|
38
|
+
"message": {
|
|
39
|
+
"message_id": 1002,
|
|
40
|
+
"from": {
|
|
41
|
+
"id": 917351484,
|
|
42
|
+
"is_bot": false,
|
|
43
|
+
"first_name": "Test",
|
|
44
|
+
"username": "test_user"
|
|
45
|
+
},
|
|
46
|
+
"chat": {
|
|
47
|
+
"id": -1003546563617,
|
|
48
|
+
"title": "Test Chat",
|
|
49
|
+
"type": "supergroup"
|
|
50
|
+
},
|
|
51
|
+
"date": 1768590001,
|
|
52
|
+
"text": "/plan",
|
|
53
|
+
"entities": [
|
|
54
|
+
{
|
|
55
|
+
"offset": 0,
|
|
56
|
+
"length": 5,
|
|
57
|
+
"type": "bot_command"
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"received_at": 1768590001000
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"update_id": 100003,
|
|
66
|
+
"chat_id": "-1003546563617",
|
|
67
|
+
"payload": {
|
|
68
|
+
"update_id": 100003,
|
|
69
|
+
"message": {
|
|
70
|
+
"message_id": 1003,
|
|
71
|
+
"from": {
|
|
72
|
+
"id": 917351484,
|
|
73
|
+
"is_bot": false,
|
|
74
|
+
"first_name": "Test",
|
|
75
|
+
"username": "test_user"
|
|
76
|
+
},
|
|
77
|
+
"chat": {
|
|
78
|
+
"id": -1003546563617,
|
|
79
|
+
"title": "Test Chat",
|
|
80
|
+
"type": "supergroup"
|
|
81
|
+
},
|
|
82
|
+
"date": 1768590002,
|
|
83
|
+
"text": "/build",
|
|
84
|
+
"entities": [
|
|
85
|
+
{
|
|
86
|
+
"offset": 0,
|
|
87
|
+
"length": 6,
|
|
88
|
+
"type": "bot_command"
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"received_at": 1768590002000
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"update_id": 100004,
|
|
97
|
+
"chat_id": "-1003546563617",
|
|
98
|
+
"payload": {
|
|
99
|
+
"update_id": 100004,
|
|
100
|
+
"message": {
|
|
101
|
+
"message_id": 1004,
|
|
102
|
+
"from": {
|
|
103
|
+
"id": 917351484,
|
|
104
|
+
"is_bot": false,
|
|
105
|
+
"first_name": "Test",
|
|
106
|
+
"username": "test_user"
|
|
107
|
+
},
|
|
108
|
+
"chat": {
|
|
109
|
+
"id": -1003546563617,
|
|
110
|
+
"title": "Test Chat",
|
|
111
|
+
"type": "supergroup"
|
|
112
|
+
},
|
|
113
|
+
"date": 1768590003,
|
|
114
|
+
"text": "/review",
|
|
115
|
+
"entities": [
|
|
116
|
+
{
|
|
117
|
+
"offset": 0,
|
|
118
|
+
"length": 7,
|
|
119
|
+
"type": "bot_command"
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"received_at": 1768590003000
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"update_id": 100005,
|
|
128
|
+
"chat_id": "-1003546563617",
|
|
129
|
+
"payload": {
|
|
130
|
+
"update_id": 100005,
|
|
131
|
+
"message": {
|
|
132
|
+
"message_id": 1005,
|
|
133
|
+
"from": {
|
|
134
|
+
"id": 917351484,
|
|
135
|
+
"is_bot": false,
|
|
136
|
+
"first_name": "Test",
|
|
137
|
+
"username": "test_user"
|
|
138
|
+
},
|
|
139
|
+
"chat": {
|
|
140
|
+
"id": -1003546563617,
|
|
141
|
+
"title": "Test Chat",
|
|
142
|
+
"type": "supergroup"
|
|
143
|
+
},
|
|
144
|
+
"date": 1768590004,
|
|
145
|
+
"text": "/review HEAD~1",
|
|
146
|
+
"entities": [
|
|
147
|
+
{
|
|
148
|
+
"offset": 0,
|
|
149
|
+
"length": 7,
|
|
150
|
+
"type": "bot_command"
|
|
151
|
+
}
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
"received_at": 1768590004000
|
|
156
|
+
}
|
|
157
|
+
]
|