Skip to content

Commit 67075d0

Browse files
committed
Update to v0.2.0
1 parent 63bb5fe commit 67075d0

File tree

3 files changed

+343
-9
lines changed

3 files changed

+343
-9
lines changed

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Please specify the version to avoid breaking changes.
99

1010
```js
1111
Blackprint.loadModuleFromURL([
12-
'https://cdn.jsdelivr.net/npm/@blackprint/nodes-telegram@0.1.x/dist/nodes-telegram.mjs'
12+
'https://cdn.jsdelivr.net/npm/@blackprint/nodes-telegram@0.2.x/dist/nodes-telegram.mjs'
1313
], {
1414
// Turn this on if you want to load .sf.js, and .sf.css
1515
// only with single .mjs
@@ -23,5 +23,17 @@ https://cdn.jsdelivr.net/gh/Blackprint/nodes-telegram@dist/nodes-telegram.mjs
2323

2424
Replace `dist` with your latest commit hash (from `dist` branch) to avoid cache from CDN.
2525

26+
## Update telegram library dependency for browser
27+
Because the telegram library doesn't include the bundled version for browser, we need to bundle it manually with:
28+
```sh
29+
$ cd ./gramjs
30+
$ git pull
31+
$ pnpm i
32+
$ cd ..
33+
$ npm run build-gramjs
34+
```
35+
36+
After that you will find the bundled .js in `./gramjs/browser/telegram.js`
37+
2638
### License
2739
MIT
Lines changed: 323 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,323 @@
1-
{"instance":{"Telegram/Connection/MTProto":[{"i":0,"x":473,"y":148,"z":5,"input_d":{"StringSession":"","RetryDelay":10000},"output":{"Client":[{"i":7,"name":"Val"}]}}],"Input/UI/Button":[{"i":1,"x":170,"y":104,"z":6,"output":{"Clicked":[{"i":0,"name":"Connect"}]}},{"i":10,"x":92,"y":565,"z":10,"output":{"Clicked":[{"i":9,"name":"Send"}]}}],"BP/Env/Get":[{"i":2,"x":97,"y":218,"z":1,"data":{"name":"TG_AUTHTOKEN"},"output":{"Val":[{"i":0,"name":"AuthToken"}]}},{"i":3,"x":143,"y":275,"z":2,"data":{"name":"TG_API_ID"},"output":{"Val":[{"i":4,"name":"In"}]}},{"i":5,"x":119,"y":336,"z":3,"data":{"name":"TG_API_HASH"},"output":{"Val":[{"i":0,"name":"API_Hash"}]}}],"Data/String/To/Number":[{"i":4,"x":304,"y":250,"z":4,"output":{"Out":[{"i":0,"name":"API_ID"}]}}],"Decoration/Group/Default":[{"i":6,"x":60,"y":36,"z":0,"data":{"width":1042,"height":372,"title":"Handle Telegram Client Connection","color":""}},{"i":13,"x":62,"y":431,"z":8,"data":{"width":1041,"height":333,"title":"Send message to someone who already /start the bot","color":""}},{"i":18,"x":61,"y":784,"z":14,"data":{"width":1041,"height":235,"title":"Listen to any new message","color":""}}],"BP/Var/Set":[{"i":7,"x":862,"y":162,"z":7,"data":{"name":"TgClient","scope":0}}],"BP/Var/Get":[{"i":8,"x":185,"y":512,"z":9,"data":{"name":"TgClient","scope":0},"output":{"Val":[{"i":9,"name":"Client"}]}},{"i":14,"x":126,"y":862,"z":18,"data":{"name":"TgClient","scope":0},"output":{"Val":[{"i":15,"name":"Client"}]}}],"Telegram/Message/SendText":[{"i":9,"x":398,"y":541,"z":13,"comment":"Make sure to fill the username/chat_id","input_d":{"ChatId":"","Username":""},"output":{"MessageId":[{"i":12,"name":"Any"}]},"output_sw":{"Message":1}}],"Input/UI/TextBox":[{"i":11,"x":98,"y":658,"z":11,"data":{"value":"hello"},"output":{"Value":[{"i":9,"name":"Text"}]}}],"Console/Log":[{"i":12,"x":748,"y":528,"z":12},{"i":16,"x":712,"y":835,"z":15},{"i":17,"x":713,"y":926,"z":16}],"Telegram/Event/UpdateNewMessage":[{"i":15,"x":320,"y":849,"z":17,"output":{"MessageSenderId":[{"i":16,"name":"Any"}],"MessageValue":[{"i":17,"name":"Any"}]},"output_sw":{"Message":1}}],"Decoration/Text/Notes":[{"i":19,"x":1137,"y":50,"z":19,"data":{"value":"Make sure to edit your Environment variables data.\\n\\n\\n------------------------\\n\\n\\nYou can obtain TG_API_ID and TG_API_HASH from Telegram's website\\nhttps://my.telegram.org/apps\\n\\n\\n------------------------\\n\\n\\nTo obtain TG_AUTHTOKEN you need to create your bot with @BotFather from Telegram (always make sure you contacted BotFather with the checkmark on his name)\\n\\nAnd send this message to him\\n/newbot\\n\\nAfter you created your bot, he will give you a token, copy the token and paste it into the environment variables (TG_AUTHTOKEN)\\n\\n\\n------------------------\\n\\n\\nYou can also follow guide from gramjs's library if something was missing\\nhttps://github.com/gram-js/gramjs#how-to-get-started"}}]},"moduleJS":["https://cdn.jsdelivr.net/npm/@blackprint/[email protected]/dist/nodes-telegram.mjs","https://cdn.jsdelivr.net/npm/@blackprint/[email protected]/dist/nodes-input.mjs","https://cdn.jsdelivr.net/npm/@blackprint/[email protected]/dist/nodes-data.mjs","https://cdn.jsdelivr.net/npm/@blackprint/[email protected]/dist/nodes-decoration.mjs","https://cdn.jsdelivr.net/npm/@blackprint/[email protected]/dist/nodes-console.mjs"],"variables":{"TgClient":{"id":"TgClient","title":"TgClient"}}}
1+
{
2+
"instance": {
3+
"Telegram/Connection/MTProto": [
4+
{
5+
"i": 0,
6+
"x": 473,
7+
"y": 148,
8+
"z": 5,
9+
"input_d": {
10+
"StringSession": "",
11+
"RetryDelay": 10000
12+
},
13+
"output": {
14+
"Client": [
15+
{
16+
"i": 7,
17+
"name": "Val"
18+
}
19+
]
20+
}
21+
}
22+
],
23+
"Input/UI/Button": [
24+
{
25+
"i": 1,
26+
"x": 170,
27+
"y": 104,
28+
"z": 6,
29+
"output": {
30+
"Clicked": [
31+
{
32+
"i": 0,
33+
"name": "Connect"
34+
}
35+
]
36+
}
37+
},
38+
{
39+
"i": 10,
40+
"x": 92,
41+
"y": 565,
42+
"z": 10,
43+
"output": {
44+
"Clicked": [
45+
{
46+
"i": 9,
47+
"name": "Send"
48+
}
49+
]
50+
}
51+
}
52+
],
53+
"BP/Env/Get": [
54+
{
55+
"i": 2,
56+
"x": 97,
57+
"y": 218,
58+
"z": 1,
59+
"data": {
60+
"name": "TG_AUTHTOKEN"
61+
},
62+
"output": {
63+
"Val": [
64+
{
65+
"i": 0,
66+
"name": "AuthToken"
67+
}
68+
]
69+
}
70+
},
71+
{
72+
"i": 3,
73+
"x": 143,
74+
"y": 275,
75+
"z": 2,
76+
"data": {
77+
"name": "TG_API_ID"
78+
},
79+
"output": {
80+
"Val": [
81+
{
82+
"i": 4,
83+
"name": "In"
84+
}
85+
]
86+
}
87+
},
88+
{
89+
"i": 5,
90+
"x": 119,
91+
"y": 336,
92+
"z": 3,
93+
"data": {
94+
"name": "TG_API_HASH"
95+
},
96+
"output": {
97+
"Val": [
98+
{
99+
"i": 0,
100+
"name": "API_Hash"
101+
}
102+
]
103+
}
104+
}
105+
],
106+
"Data/String/To/Number": [
107+
{
108+
"i": 4,
109+
"x": 304,
110+
"y": 250,
111+
"z": 4,
112+
"output": {
113+
"Out": [
114+
{
115+
"i": 0,
116+
"name": "API_ID"
117+
}
118+
]
119+
}
120+
}
121+
],
122+
"Decoration/Group/Default": [
123+
{
124+
"i": 6,
125+
"x": 60,
126+
"y": 36,
127+
"z": 0,
128+
"data": {
129+
"width": 1042,
130+
"height": 372,
131+
"title": "Handle Telegram Client Connection",
132+
"color": ""
133+
}
134+
},
135+
{
136+
"i": 13,
137+
"x": 62,
138+
"y": 431,
139+
"z": 8,
140+
"data": {
141+
"width": 1041,
142+
"height": 333,
143+
"title": "Send message to someone who already /start the bot",
144+
"color": ""
145+
}
146+
},
147+
{
148+
"i": 18,
149+
"x": 61,
150+
"y": 784,
151+
"z": 14,
152+
"data": {
153+
"width": 1041,
154+
"height": 235,
155+
"title": "Listen to any new message",
156+
"color": ""
157+
}
158+
}
159+
],
160+
"BP/Var/Set": [
161+
{
162+
"i": 7,
163+
"x": 862,
164+
"y": 162,
165+
"z": 7,
166+
"data": {
167+
"name": "TgClient",
168+
"scope": 0
169+
}
170+
}
171+
],
172+
"BP/Var/Get": [
173+
{
174+
"i": 8,
175+
"x": 185,
176+
"y": 512,
177+
"z": 9,
178+
"data": {
179+
"name": "TgClient",
180+
"scope": 0
181+
},
182+
"output": {
183+
"Val": [
184+
{
185+
"i": 9,
186+
"name": "Client"
187+
}
188+
]
189+
}
190+
},
191+
{
192+
"i": 14,
193+
"x": 126,
194+
"y": 862,
195+
"z": 18,
196+
"data": {
197+
"name": "TgClient",
198+
"scope": 0
199+
},
200+
"output": {
201+
"Val": [
202+
{
203+
"i": 15,
204+
"name": "Client"
205+
}
206+
]
207+
}
208+
}
209+
],
210+
"Telegram/Message/SendText": [
211+
{
212+
"i": 9,
213+
"x": 398,
214+
"y": 541,
215+
"z": 13,
216+
"comment": "Make sure to fill the username/chat_id",
217+
"input_d": {
218+
"ChatId": "",
219+
"Username": ""
220+
},
221+
"output": {
222+
"MessageId": [
223+
{
224+
"i": 12,
225+
"name": "Any"
226+
}
227+
]
228+
},
229+
"output_sw": {
230+
"Message": 1
231+
}
232+
}
233+
],
234+
"Input/UI/TextBox": [
235+
{
236+
"i": 11,
237+
"x": 98,
238+
"y": 658,
239+
"z": 11,
240+
"data": {
241+
"value": "hello"
242+
},
243+
"output": {
244+
"Value": [
245+
{
246+
"i": 9,
247+
"name": "Text"
248+
}
249+
]
250+
}
251+
}
252+
],
253+
"Console/Log": [
254+
{
255+
"i": 12,
256+
"x": 748,
257+
"y": 528,
258+
"z": 12
259+
},
260+
{
261+
"i": 16,
262+
"x": 712,
263+
"y": 835,
264+
"z": 15
265+
},
266+
{
267+
"i": 17,
268+
"x": 713,
269+
"y": 926,
270+
"z": 16
271+
}
272+
],
273+
"Telegram/Event/UpdateNewMessage": [
274+
{
275+
"i": 15,
276+
"x": 320,
277+
"y": 849,
278+
"z": 17,
279+
"output": {
280+
"MessageSenderId": [
281+
{
282+
"i": 16,
283+
"name": "Any"
284+
}
285+
],
286+
"MessageValue": [
287+
{
288+
"i": 17,
289+
"name": "Any"
290+
}
291+
]
292+
},
293+
"output_sw": {
294+
"Message": 1
295+
}
296+
}
297+
],
298+
"Decoration/Text/Notes": [
299+
{
300+
"i": 19,
301+
"x": 1137,
302+
"y": 50,
303+
"z": 19,
304+
"data": {
305+
"value": "Make sure to edit your Environment variables data.\\n\\n\\n------------------------\\n\\n\\nYou can obtain TG_API_ID and TG_API_HASH from Telegram's website\\nhttps://my.telegram.org/apps\\n\\n\\n------------------------\\n\\n\\nTo obtain TG_AUTHTOKEN you need to create your bot with @BotFather from Telegram (always make sure you contacted BotFather with the checkmark on his name)\\n\\nAnd send this message to him\\n/newbot\\n\\nAfter you created your bot, he will give you a token, copy the token and paste it into the environment variables (TG_AUTHTOKEN)\\n\\n\\n------------------------\\n\\n\\nYou can also follow guide from gramjs's library if something was missing\\nhttps://github.com/gram-js/gramjs#how-to-get-started"
306+
}
307+
}
308+
]
309+
},
310+
"moduleJS": [
311+
"https://cdn.jsdelivr.net/npm/@blackprint/[email protected]/dist/nodes-telegram.mjs",
312+
"https://cdn.jsdelivr.net/npm/@blackprint/[email protected]/dist/nodes-input.mjs",
313+
"https://cdn.jsdelivr.net/npm/@blackprint/[email protected]/dist/nodes-data.mjs",
314+
"https://cdn.jsdelivr.net/npm/@blackprint/[email protected]/dist/nodes-decoration.mjs",
315+
"https://cdn.jsdelivr.net/npm/@blackprint/[email protected]/dist/nodes-console.mjs"
316+
],
317+
"variables": {
318+
"TgClient": {
319+
"id": "TgClient",
320+
"title": "TgClient"
321+
}
322+
}
323+
}

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@blackprint/nodes-telegram",
33
"description": "Blackprint nodes for Telegram",
4-
"version": "0.1.0-dep",
4+
"version": "0.2.0",
55
"license": "MIT",
66
"repository": {
77
"type": "git",
@@ -18,14 +18,14 @@
1818
},
1919
"devDependencies": {
2020
"scarletsframe": "0.35.x",
21-
"@blackprint/engine": "0.9.x",
22-
"@blackprint/sketch": "0.9.x",
21+
"@blackprint/engine": "0.10.x",
22+
"@blackprint/sketch": "0.10.x",
2323
"@blackprint/cli-tools": "0.3.x",
24-
"jest": "29.x",
25-
"jest-environment-node": "29.x",
26-
"jest-environment-jsdom": "29.x"
24+
"jest": "30.x",
25+
"jest-environment-node": "30.x",
26+
"jest-environment-jsdom": "30.x"
2727
},
2828
"keywords": [
2929
"blackprint"
3030
]
31-
}
31+
}

0 commit comments

Comments
 (0)