diff --git a/package.json b/package.json index 9340785..c5b66ed 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "license": "MIT", "node-red": { "nodes": { + "telegram-account-auth": "sample/auth.js", "telegram-account-config": "sample/config.js", "telegram-account-receiver": "sample/receiver.js", "telegram-account-command": "sample/command.js", @@ -21,7 +22,7 @@ "telegram-account-send-file": "sample/send-file.js", "telegram-account-entity": "sample/get-entity.js", "telegram-account-delete-message": "sample/delete-message.js", - "telegram-account-iter-dialog": "sample/iter-dialogs.js", + "telegram-account-iter-dialog": "sample/iter-dialogs.js", "telegram-account-iter-messages": "sample/iter-messages.js" } }, diff --git a/sample/command.html b/sample/command.html index 354172b..243ad5a 100644 --- a/sample/command.html +++ b/sample/command.html @@ -58,3 +58,78 @@ + + diff --git a/sample/command.js b/sample/command.js index da05f2d..a49e1c9 100644 --- a/sample/command.js +++ b/sample/command.js @@ -1,6 +1,6 @@ const { NewMessage } = require("telegram/events"); -// event.js + module.exports = function (RED) { function Command(config) { RED.nodes.createNode(this, config); @@ -19,27 +19,25 @@ module.exports = function (RED) { const regex = new RegExp(config.command); if (regex.test(message)) { - // Создаем объект сообщения для отправки в следующий узел + var msg = { payload: { update - // Другие поля сообщения, которые вы хотите передать } }; - // Отправляем объект сообщения в следующий узел + node.send(msg); } } else if (message === config.command) { - // Создаем объект сообщения для отправки в следующий узел + var msg = { payload: { update - // Другие поля сообщения, которые вы хотите передать } }; - // Отправляем объект сообщения в следующий узел + node.send(msg); } } diff --git a/sample/delete-message.html b/sample/delete-message.html index 5fee4e9..22c7282 100644 --- a/sample/delete-message.html +++ b/sample/delete-message.html @@ -43,5 +43,54 @@ \ No newline at end of file +
The delete-message node allows you to delete messages from a Telegram chat. It supports deleting multiple messages at once and provides an option to revoke messages for all chat participants.
+ +The delete-message node uses the Telegram API to delete messages from a specified chat. It can delete a single message or multiple messages at once. If the revoke
parameter is set to true, the messages will be removed for all participants, not just the sender.
+ { + "payload": { + "chatId": "@example_user", + "messageIds": [12345, 12346], + "revoke": true + } + } ++
This input deletes the messages with IDs 12345 and 12346 from the chat with the user @example_user
, revoking them for all participants.
The node can use a globally configured Telegram client or a client instance provided in the message payload. Ensure that the client has the necessary permissions to delete messages from the specified chat.
+ diff --git a/sample/get-entity.html b/sample/get-entity.html index 845fdd1..e74e719 100644 --- a/sample/get-entity.html +++ b/sample/get-entity.html @@ -40,3 +40,48 @@ /> + + + diff --git a/sample/iter-dialogs.html b/sample/iter-dialogs.html index dd53ce6..1c53823 100644 --- a/sample/iter-dialogs.html +++ b/sample/iter-dialogs.html @@ -126,3 +126,87 @@ /> + + + diff --git a/sample/iter-messages.html b/sample/iter-messages.html index b5e1594..8513f58 100644 --- a/sample/iter-messages.html +++ b/sample/iter-messages.html @@ -253,4 +253,113 @@ ng-model="scheduled" /> - \ No newline at end of file + + + diff --git a/sample/iter-messages.js b/sample/iter-messages.js index 719cfff..cceba1c 100644 --- a/sample/iter-messages.js +++ b/sample/iter-messages.js @@ -51,8 +51,6 @@ module.exports = function (RED) { if (offsetDate) { params.offsetDate = new Date(offsetDate).getTime() / 1000; } - console.log("🚀 ~ file: iter-messages.js:58 ~ params:", params) - console.log(chatId) if (chatId[0] === "@") { peerId = await client.getEntity(chatId); diff --git a/sample/receiver.html b/sample/receiver.html index c2e565e..534e09c 100644 --- a/sample/receiver.html +++ b/sample/receiver.html @@ -54,3 +54,75 @@ + + + diff --git a/sample/receiver.js b/sample/receiver.js index c425eb9..36e8e58 100644 --- a/sample/receiver.js +++ b/sample/receiver.js @@ -1,6 +1,5 @@ const { NewMessage } = require("telegram/events"); -// event.js module.exports = function (RED) { function Receiver(config) { RED.nodes.createNode(this, config); diff --git a/sample/send-file.html b/sample/send-file.html index ef4d9fe..90e033d 100644 --- a/sample/send-file.html +++ b/sample/send-file.html @@ -314,3 +314,150 @@ /> + + + diff --git a/sample/send-message.html b/sample/send-message.html index ce34199..f38fb43 100644 --- a/sample/send-message.html +++ b/sample/send-message.html @@ -209,4 +209,92 @@ - \ No newline at end of file + + + diff --git a/sample/send-message.js b/sample/send-message.js index e0677a6..ee968a1 100644 --- a/sample/send-message.js +++ b/sample/send-message.js @@ -50,7 +50,6 @@ module.exports = function (RED) { commentTo: commentTo !== "" ? commentTo : undefined, topMsgId: topMsgId !== topMsgId ? commentTo : undefined, }; - console.log("🚀 ~ file: send-message.js:60 ~ params:", params) if (schedule) { params.schedule = new Date(schedule).getTime() / 1000; @@ -77,6 +76,7 @@ module.exports = function (RED) { } }); + } RED.nodes.registerType('send-message', SendMessage);