Skip to content

Commit

Permalink
Merge pull request #357 from gmag11/master
Browse files Browse the repository at this point in the history
Typo fix in getfile command. Add full weblink in the response message
  • Loading branch information
windkh committed Jan 30, 2024
2 parents 9db1ae5 + af0fa8f commit bd4bd2c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/getfile.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"id":"56385912acc6a6ba","type":"telegram receiver","z":"ec1cf3fd9654e7e5","name":"","bot":"65ca12172854cc2d","saveDataDir":"","filterCommands":false,"x":190,"y":220,"wires":[["c570b04911862843","3f26294392ed5771"],[]]},{"id":"c7d66fca7bbfef5b","type":"telegram sender","z":"ec1cf3fd9654e7e5","name":"","bot":"65ca12172854cc2d","haserroroutput":false,"outputs":1,"x":750,"y":220,"wires":[["4321b804e33f0b4a"]]},{"id":"4321b804e33f0b4a","type":"debug","z":"ec1cf3fd9654e7e5","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":950,"y":220,"wires":[]},{"id":"3f26294392ed5771","type":"function","z":"ec1cf3fd9654e7e5","name":"get info about first photo manually","func":"if(msg.payload.type === 'photo'){\n \n // manually download the first photo using the fileId.\n msg.payload.gefile = {\n fileId : msg.payload.photos[0].file_id,\n }\n return msg;\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":460,"y":220,"wires":[["c7d66fca7bbfef5b"]]},{"id":"65ca12172854cc2d","type":"telegram bot","botname":"HeinzBot","usernames":"","chatids":"","baseapiurl":"","updatemode":"polling","pollinterval":"1000","usesocks":false,"sockshost":"192.168.178.200","socksprotocol":"socks5","socksport":"1080","socksusername":"","sockspassword":"","bothost":"","botpath":"","localbotport":"8443","publicbotport":"8443","privatekey":"","certificate":"","useselfsignedcertificate":false,"sslterminated":false,"verboselogging":true}]
[{"id":"56385912acc6a6ba","type":"telegram receiver","z":"ec1cf3fd9654e7e5","name":"","bot":"65ca12172854cc2d","saveDataDir":"","filterCommands":false,"x":190,"y":220,"wires":[["c570b04911862843","3f26294392ed5771"],[]]},{"id":"c7d66fca7bbfef5b","type":"telegram sender","z":"ec1cf3fd9654e7e5","name":"","bot":"65ca12172854cc2d","haserroroutput":false,"outputs":1,"x":750,"y":220,"wires":[["4321b804e33f0b4a"]]},{"id":"4321b804e33f0b4a","type":"debug","z":"ec1cf3fd9654e7e5","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":950,"y":220,"wires":[]},{"id":"3f26294392ed5771","type":"function","z":"ec1cf3fd9654e7e5","name":"get info about first photo manually","func":"if(msg.payload.type === 'photo'){\n \n // manually download the first photo using the fileId.\n msg.payload.getfile = {\n fileId : msg.payload.photos[msg.payload.photos.length - 1].file_id,\n }\n return msg;\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":460,"y":220,"wires":[["c7d66fca7bbfef5b"]]},{"id":"65ca12172854cc2d","type":"telegram bot","botname":"HeinzBot","usernames":"","chatids":"","baseapiurl":"","updatemode":"polling","pollinterval":"1000","usesocks":false,"sockshost":"192.168.178.200","socksprotocol":"socks5","socksport":"1080","socksusername":"","sockspassword":"","bothost":"","botpath":"","localbotport":"8443","publicbotport":"8443","privatekey":"","certificate":"","useselfsignedcertificate":false,"sslterminated":false,"verboselogging":true}]
11 changes: 9 additions & 2 deletions telegrambot/99-telegrambot.js
Original file line number Diff line number Diff line change
Expand Up @@ -2171,15 +2171,22 @@ module.exports = function (RED) {
node.processResult(result, msg, nodeSend, nodeDone);
});
} else if (msg.payload.getfile) {
let fileId = msg.payload.getFile.fileId;
let fileId = msg.payload.getfile.fileId;

telegramBot
.getFile(fileId)
.catch(function (ex) {
node.processError(ex, msg, nodeSend, nodeDone);
})
.then(function (result) {
node.processResult(result, msg, nodeSend, nodeDone);
telegramBot.getFileLink(fileId)

Check failure on line 2182 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Insert `␍⏎····························`

Check failure on line 2182 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Insert `␍⏎····························`

Check failure on line 2182 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (19.x)

Insert `␍⏎····························`

Check failure on line 2182 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Insert `␍⏎····························`
.catch(function (ex) {

Check failure on line 2183 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Insert `····`

Check failure on line 2183 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Insert `····`

Check failure on line 2183 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (19.x)

Insert `····`

Check failure on line 2183 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Insert `····`
node.processError(ex, msg, nodeSend, nodeDone);

Check failure on line 2184 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Insert `····`

Check failure on line 2184 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Insert `····`

Check failure on line 2184 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (19.x)

Insert `····`

Check failure on line 2184 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Insert `····`
})

Check failure on line 2185 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Insert `····`

Check failure on line 2185 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Insert `····`

Check failure on line 2185 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (19.x)

Insert `····`

Check failure on line 2185 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Insert `····`
.then(function (weblink) {

Check failure on line 2186 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Replace `························` with `····························`

Check failure on line 2186 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Replace `························` with `····························`

Check failure on line 2186 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (19.x)

Replace `························` with `····························`

Check failure on line 2186 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Replace `························` with `····························`
msg.weblink = weblink;

Check failure on line 2187 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Insert `····`

Check failure on line 2187 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Insert `····`

Check failure on line 2187 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (19.x)

Insert `····`

Check failure on line 2187 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Insert `····`
node.processResult(result, msg, nodeSend, nodeDone);

Check failure on line 2188 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Replace `····························` with `································`

Check failure on line 2188 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Replace `····························` with `································`

Check failure on line 2188 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (19.x)

Replace `····························` with `································`

Check failure on line 2188 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Replace `····························` with `································`
});

Check failure on line 2189 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Insert `····`

Check failure on line 2189 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Insert `····`

Check failure on line 2189 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (19.x)

Insert `····`

Check failure on line 2189 in telegrambot/99-telegrambot.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Insert `····`
});
} else {
if (msg.payload.type) {
Expand Down

0 comments on commit bd4bd2c

Please sign in to comment.