windkh / node-red-contrib-telegrambot

Telegram bot nodes for node-red.
Other
264 stars 117 forks source link

Can't receive more messages until I update the bot settings (into NR) #287

Closed Barabba11 closed 1 year ago

Barabba11 commented 1 year ago

Hi, it's a bit strange, I have 14.8.7, running oon NR 1.3.5 and Node v14.17.2 on a Pi3b, usally it happens when the internet goes off, like a timeout in the polling create the problem after, I can't receive more messages on receiver node. The sender works ok. I should update the bot settings (without changing nothing), and after some seconds I'l receive on my alla answers from NR, for all messages I sent and that were't received. So, after update, all the messages in queue exit from node and produce the result (I receive on phone the feedback). Is it maybe a problem connected to the old NR version?

koosoli commented 1 year ago

For me, this stopped working on the 18th of December. I think the last update was not good. I have the same constellation and I do not receive anymore messages.

Barabba11 commented 1 year ago

have you tried to update the settings of module, about bot? I tolved me. By the way NR was always able to send messages, ony received mesages didn't go out from module, they were queued and after update I received all at ance

koosoli commented 1 year ago

Ok, I just saw that I am not on the latest version, but I can also not really update:

2022-12-30T12:54:32.859Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-contrib-telegrambot@14.8.7
2022-12-30T12:54:35.252Z [err] npm WARN config production Use `--omit=dev` instead.
2022-12-30T13:02:16.599Z [err] npm
2022-12-30T13:02:16.599Z [err]  ERR! code ETIMEDOUT
2022-12-30T13:02:16.600Z [err] npm 
2022-12-30T13:02:16.600Z [err] ERR!
2022-12-30T13:02:16.601Z [err]  syscall connect
2022-12-30T13:02:16.601Z [err] npm ERR!
2022-12-30T13:02:16.601Z [err]  
2022-12-30T13:02:16.602Z [err] errno
2022-12-30T13:02:16.602Z [err]  ETIMEDOUT
2022-12-30T13:02:16.612Z [err] npm ERR! network
2022-12-30T13:02:16.612Z [err]  request to https://registry.npmjs.org/node-red-contrib-telegrambot failed, reason: connect ETIMEDOUT 2606:4700::6810:1023:443
2022-12-30T13:02:16.612Z [err] npm ERR! network
2022-12-30T13:02:16.613Z [err]  This is a problem related to network connectivity.
2022-12-30T13:02:16.613Z [err] npm ERR! network In most cases you are behind a proxy or have bad network settings.
2022-12-30T13:02:16.613Z [err] npm 
2022-12-30T13:02:16.613Z [err] ERR! network 
2022-12-30T13:02:16.613Z [err] npm ERR!
2022-12-30T13:02:16.613Z [err]  
2022-12-30T13:02:16.614Z [err] network If you are behind a proxy, please make sure that the
2022-12-30T13:02:16.614Z [err] npm ERR! network 'proxy' config is set properly.  See: 'npm help config'
2022-12-30T13:02:16.621Z [err] 
2022-12-30T13:02:16.621Z [err] npm ERR!
2022-12-30T13:02:16.621Z [err]  A complete log of this run can be found in:
2022-12-30T13:02:16.621Z [err] npm ERR!     /root/.npm/_logs/2022-12-30T12_54_35_018Z-debug-0.log
2022-12-30T13:02:16.646Z rc=1

What do I need to update in the settings? I am still using the same bot...hmmm

Barabba11 commented 1 year ago

your device is not properly connected to internet, for this reason you've problems with Telegram too

koosoli commented 1 year ago

That is strange, Home Assistant is still connected, I did also deactivate adguard. But since it has been working, I did not really change anything.

Barabba11 commented 1 year ago

it happened again, this time without an internet failure, send is ok, receive stop working until I update module settings

windkh commented 1 year ago

This seems to be the same as described here #282

Barabba11 commented 1 year ago

This seems to be the same as described here #282

In my opinion it doesn't look like that, The node have never had problems to send messages, any time, and it doesn suddenly. The problem is only about receving messages

Barabba11 commented 1 year ago

today the commands were received and transmitted to nodes, the receiver node didn't produce output, then I updated the bot settings and it started working, but I haven't received the previous "queued" messages. A bit strange behaviour here

windkh commented 1 year ago

@Barabba11 these type of problems were reported before. Everytime this only happens on a raspi. Don't ask me why. in #282 it is described that it makes a difference how node-red was installed on the raspi.

Maybe you can try that or you can user the control node to find out of polling stalls when you discover those effects.

Barabba11 commented 1 year ago

Thanks for kind support, I'm not the programmer.. but I would bet it's not depending on polling.. after all the command module is responsing now promptly, so the polling itself should working fine. At this time I can say I figured out 3 problems:

Can it be an incompatibility with NR or Nodejs? My versions are not the latest.. I would like to downgrade back to 10.0.4, is it dangerous? Will it create problems or should I completely reconfigure bot after that? can you please kindly tell me how to force that downngrade? I suppose I shoould stop NR and use smething like npm i ... under the .node-red folder. The telegram module was installed by palette, NR was installed under pi user, not root. Thanks

Barabba11 commented 1 year ago

May you kindly please tell me how may I downgrade back to 10.0.4 (or other version that you suggest) (should I uninstall first?) and if it's dangerous (I'll loose token or ay other problem) thank you!

Barabba11 commented 1 year ago

I hope somebody can help me downgrade, thank you!

windkh commented 1 year ago

Just download the old package and copy it manually to the node_modules folder

Barabba11 commented 1 year ago

thanks for reply, I followed your suggestion, I stopped NR, made a backup of existing files, overwritten with old release 10.4, started NR and got error

13 Jan 00:23:22 - [warn] ------------------------------------------------------
13 Jan 00:23:22 - [warn] [node-red-contrib-telegrambot/telegrambot] Error: Cannot find module 'socks5-https-client/lib/Agent'

Flow were stopped, so I replaced the backuped files and all seams ok. But I haven't downgraded, so how can I proceed? If I?m not wrong there was something like npm i <name of old package", but I?m not sure and I'm afraid I could create problems/corruptions on my flow. Thanks for help

Barabba11 commented 1 year ago

I think the bug is somehow connected to the virtual keyboard, I've restarted NR and sent a normal text, for testing puroposes I've placed a receive node and created an echo, in the function I filter out any chance to move forward text contaning the keyboard respones and "/" commands. Other commands note I have are properly configured. It looks like also a normal text triggers the "context.global.keyboard = {pending:true}", no sense, but same effect. SO I addecd in that function a context.global.keyboard = {pending:false}; and sent a text, I got echo, but I can't get rid of keyboard. Probably this thing in the long run creates the crash on receving messages.

when I stop the NR the keyboard on my phone disapperaed, start again and no keyboard, sent a single text and keyboard appeared!

Barabba11 commented 1 year ago

Hi, today I've upgraded all to the latest verisone (NR@3.02, nodeJS v14.21.2), I don't see yet the update 14.9 avalable on palette, so I tried to force it with npm install node-red-contrib-telegrambot but it's not updraging. Now when I reboot NR I dont' see keyboard, but has I type a message (not a command) I see it, and I will not be out of it till a soft restart of module. This is the same as before So it's not due to old platform lik I hoped so to solve it, is it caused from a bug of the module or did I do someting wrong? Please help, than you

windkh commented 1 year ago

please send me your flow

Barabba11 commented 1 year ago

Hi, thanks for your kins support, please have a look if something is wrong here ` removed

Barabba11 commented 1 year ago

since now it didn't stop receiving messages (I?m testing with the echo function node), but I can't get rid from the keyboard, once I send command to rise it, The only way is to restart node itself (or whole NR) again

windkh commented 1 year ago

Hi @Barabba11 I tested your flow (after removing the parts that I do not need) and it basically worked with my Telegram Desktop Client on Windows. The keyboard disappears correctly. So what client do you use?

image

windkh commented 1 year ago

@Barabba11 Note that I disconnected your receiver node as I do not know what it does

Barabba11 commented 1 year ago

thank you for testing it, I'm using raspberry 3B, with latest packages/NR/module, after updating (but keeping the 14.8, because the 15.0.1 was not available yet on palette, the good news is that the receiving node, that I use as an echo (I send "hello" and I see "hello" coming back, showing me system is online and promptly can notice me about everything, and this is its reason/meaning in the flow) now always work.. not like before it sopped working after one day (but transmit node always worked), They keboard not disappeared. Now I updated with 15.0.1: after process completed the keyboard in my telegram chat disappeared, I send a command and correctly appears, I select the answer, it keeps there.

About your picture, I can say it's the same for me, but the problem comes after, when I open again the chat, the keyboard still there, and pressing one of the choices doesn't produce any echo from NR Screenshot_2023-01-29-16-44-28-286_org telegram messenger

Barabba11 commented 1 year ago

I would correct the prevous post, I've restarted NR because the module wasn't updated wthout it, and I also deleted chat on prone and searched again for bot. With 15.0.1 situation hasn't changed, whrn I opened the chat the keayboard was there already, so mabe this is a bug of telegram android app? Keyboard keeps there, anyway the commands are working. SOmethign still in that chat which is unsatisfied

Barabba11 commented 1 year ago

the original problem was solved by updating NR and so on, the keyboard problem depends on Android version, when I deal with desktop version it behaves ok