@patricktobias86/node-red-telegram-account 1.2.2 → 1.2.3
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/CHANGELOG.md +4 -0
- package/nodes/command.js +5 -0
- package/nodes/delete-message.js +5 -0
- package/nodes/get-entity.js +5 -0
- package/nodes/iter-dialogs.js +6 -0
- package/nodes/iter-messages.js +6 -0
- package/nodes/promote-admin.js +6 -0
- package/nodes/send-file.js +5 -0
- package/nodes/send-message.js +6 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.2.2] - 2026-03-07
|
|
6
|
+
### Added
|
|
7
|
+
- Added guarded checks before the Telegram client is called to avoid errors when the client is not available.
|
|
8
|
+
|
|
5
9
|
## [1.2.1] - 2026-01-22
|
|
6
10
|
### Added
|
|
7
11
|
- Receiver node option to disable emitting edited message updates (useful to prevent duplicate outputs when counters/markup change on channel posts).
|
package/nodes/command.js
CHANGED
package/nodes/delete-message.js
CHANGED
|
@@ -18,6 +18,11 @@ module.exports = function (RED) {
|
|
|
18
18
|
/** @type {TelegramClient} */
|
|
19
19
|
const client = msg.payload?.client ? msg.payload.client : this.config.client;
|
|
20
20
|
|
|
21
|
+
if (!client) {
|
|
22
|
+
node.error('No Telegram client available. Check account configuration.');
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
21
26
|
try {
|
|
22
27
|
const response = await client.deleteMessages(chatId, messageIds, { revoke });
|
|
23
28
|
|
package/nodes/get-entity.js
CHANGED
|
@@ -14,6 +14,11 @@ module.exports = function (RED) {
|
|
|
14
14
|
/** @type {TelegramClient} */
|
|
15
15
|
const client = msg.payload?.client ? msg.payload.client : this.config.client;
|
|
16
16
|
|
|
17
|
+
if (!client) {
|
|
18
|
+
node.error('No Telegram client available. Check account configuration.');
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
17
22
|
try {
|
|
18
23
|
let entity;
|
|
19
24
|
|
package/nodes/iter-dialogs.js
CHANGED
|
@@ -15,6 +15,12 @@ module.exports = function (RED) {
|
|
|
15
15
|
|
|
16
16
|
/** @type {TelegramClient} */
|
|
17
17
|
const client = msg.payload?.client ? msg.payload.client : this.config.client;
|
|
18
|
+
|
|
19
|
+
if (!client) {
|
|
20
|
+
node.error('No Telegram client available. Check account configuration.');
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
18
24
|
const limit = msg.payload.limit || config.limit;
|
|
19
25
|
const offsetDate = msg.payload.offsetDate || config.offsetDate;
|
|
20
26
|
const offsetId = msg.payload.offsetId || config.offsetId;
|
package/nodes/iter-messages.js
CHANGED
|
@@ -15,6 +15,12 @@ module.exports = function (RED) {
|
|
|
15
15
|
|
|
16
16
|
/** @type {TelegramClient} */
|
|
17
17
|
const client = msg.payload?.client ? msg.payload.client : this.config.client;
|
|
18
|
+
|
|
19
|
+
if (!client) {
|
|
20
|
+
node.error('No Telegram client available. Check account configuration.');
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
18
24
|
const chatId = msg.payload?.chatId ? msg.payload.chatId : config.chatId;
|
|
19
25
|
let peerId = chatId === "me" ? chatId : utils.parseID(chatId);
|
|
20
26
|
|
package/nodes/promote-admin.js
CHANGED
|
@@ -15,6 +15,12 @@ module.exports = function (RED) {
|
|
|
15
15
|
node.log('promote-admin input: ' + JSON.stringify(msg));
|
|
16
16
|
}
|
|
17
17
|
const client = msg.payload?.client || this.config.client;
|
|
18
|
+
|
|
19
|
+
if (!client) {
|
|
20
|
+
node.error('No Telegram client available. Check account configuration.');
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
18
24
|
const chatId = msg.payload.chatId || config.chatId;
|
|
19
25
|
const userId = msg.payload.userId || config.userId;
|
|
20
26
|
const rank = msg.payload.rank || config.rank || "admin";
|
package/nodes/send-file.js
CHANGED
|
@@ -36,6 +36,11 @@ module.exports = function (RED) {
|
|
|
36
36
|
/** @type {TelegramClient} */
|
|
37
37
|
const client = msg.payload?.client ? msg.payload.client : this.config.client;
|
|
38
38
|
|
|
39
|
+
if (!client) {
|
|
40
|
+
node.error('No Telegram client available. Check account configuration.');
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
39
44
|
try {
|
|
40
45
|
const params = {
|
|
41
46
|
file: files,
|
package/nodes/send-message.js
CHANGED
|
@@ -34,6 +34,12 @@ module.exports = function (RED) {
|
|
|
34
34
|
|
|
35
35
|
/** @type {TelegramClient} */
|
|
36
36
|
const client = msg.payload?.client ? msg.payload.client : this.config.client;
|
|
37
|
+
|
|
38
|
+
if (!client) {
|
|
39
|
+
node.error('No Telegram client available. Check account configuration.');
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
37
43
|
let peerId = chatId === "me" ? chatId : parseID(chatId);
|
|
38
44
|
|
|
39
45
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patricktobias86/node-red-telegram-account",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "Node-RED nodes to communicate with TeleProto.",
|
|
5
5
|
"main": "nodes/config.js",
|
|
6
6
|
"keywords": [
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"registry": "https://registry.npmjs.org"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"teleproto": "^1.
|
|
47
|
+
"teleproto": "^1.223.1"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"mocha": "^11.7.1",
|