Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frage wird automatsich abgebrochen nach xx Sekunden #848

Open
peoples0815 opened this issue Aug 1, 2024 · 4 comments
Open

Frage wird automatsich abgebrochen nach xx Sekunden #848

peoples0815 opened this issue Aug 1, 2024 · 4 comments

Comments

@peoples0815
Copy link

Beim Senden einer Frage über die unten beschriebene Funktion wird nach ca. 15 bis 20 Sekunden die Frage von selbst mit "Nein" beantwortet, unabhängig von dem Zeitlimit das im Adapter eingestellt ist.

To Reproduce

  1. Scripte in IoB öffnen
  2. Script einfügen und ausführen
  3. gesendete Telegramfrage nicht beantworten
  4. nach ca. 15 - 20 Sekunden kommt die Meldung: Die Antwort war Nein

Expected behavior
Warten bis zum Ablauf der eingestellten Zeit oder dem auswählen einer Antwort

Script
`
sendTo('telegram.0', 'ask', {
text: 'Are you sure?',
reply_markup: {
inline_keyboard: [
// two buttons could be on one line too, but here they are on different
[{ text: 'Yes!', callback_data: '1' }], // first line
[{ text: 'No...', callback_data: '0' }] // second line
]
}
}, msg => {
// Auf die Antwort reagieren
if ( msg.data == 'y' ) {
sendTo("telegram.0", "send", { text: 'Die Antwort war Ja',chatId: 232821635});
} else {
sendTo("telegram.0", "send", { text: 'Die Antwort war Nein',chatId: 232821635});
}
});

`

Versions:

  • Adapter version: 3.3.2 / 3.9.0
  • JS-Controller version: 5.0.19
  • Node version: v18.20.2
  • Operating system: Debian
@mcm1957
Copy link
Member

mcm1957 commented Aug 1, 2024

Please attach a log with level denug

@peoples0815
Copy link
Author

peoples0815 commented Aug 2, 2024

2024-08-02 12:06:16.339 - info: host.IoBroker stopInstance system.adapter.telegram.0 (force=false, process=true) 2024-08-02 12:06:16.369 - info: telegram.0 (1119186) Got terminate signal TERMINATE_YOURSELF 2024-08-02 12:06:16.409 - info: host.IoBroker stopInstance system.adapter.telegram.0 send kill signal 2024-08-02 12:06:16.872 - info: telegram.0 (1119186) terminating 2024-08-02 12:06:16.874 - info: telegram.0 (1119186) Terminated (ADAPTER_REQUESTED_TERMINATION): Without reason 2024-08-02 12:06:17.499 - info: host.IoBroker instance system.adapter.telegram.0 terminated with code 11 (ADAPTER_REQUESTED_TERMINATION) 2024-08-02 12:06:19.544 - info: host.IoBroker instance system.adapter.telegram.0 started with pid 1119202 2024-08-02 12:06:20.711 - debug: telegram.0 (1119202) Redis Objects: Use Redis connection: 127.0.0.1:9001 2024-08-02 12:06:20.779 - debug: telegram.0 (1119202) Objects client ready ... initialize now 2024-08-02 12:06:20.795 - debug: telegram.0 (1119202) Objects create System PubSub Client 2024-08-02 12:06:20.796 - debug: telegram.0 (1119202) Objects create User PubSub Client 2024-08-02 12:06:20.915 - debug: telegram.0 (1119202) Objects client initialize lua scripts 2024-08-02 12:06:20.923 - debug: telegram.0 (1119202) Objects connected to redis: 127.0.0.1:9001 2024-08-02 12:06:21.004 - debug: telegram.0 (1119202) Redis States: Use Redis connection: 127.0.0.1:9000 2024-08-02 12:06:21.125 - debug: telegram.0 (1119202) States create System PubSub Client 2024-08-02 12:06:21.125 - debug: telegram.0 (1119202) States create User PubSub Client 2024-08-02 12:06:21.248 - debug: telegram.0 (1119202) States connected to redis: 127.0.0.1:9000 2024-08-02 12:06:21.325 - debug: telegram.0 (1119202) Plugin sentry Initialize Plugin (enabled=true) 2024-08-02 12:06:21.330 - info: telegram.0 (1119202) Plugin sentry Sentry Plugin disabled for this process because sending of statistic data is disabled for the system 2024-08-02 12:06:21.679 - info: telegram.0 (1119202) starting. Version 3.9.0 in /opt/iobroker/node_modules/iobroker.telegram, node: v18.20.2, js-controller: 5.0.19 2024-08-02 12:06:21.717 - debug: telegram.0 (1119202) Schedule restart: 4 5 * * * 2024-08-02 12:06:21.999 - debug: telegram.0 (1119202) Start polling with: 300(number) ms interval 2024-08-02 12:06:22.158 - debug: telegram.0 (1119202) getMe: {"id":XXXXXXXXXXXXXX,"is_bot":true,"first_name":"IoBroker","username":"XXXXXXXXXX_XXXXXXXXXXX_Bot","can_join_groups":true,"can_read_all_group_messages":false,"supports_inline_queries":false,"can_connect_to_business":false,"has_main_web_app":false} 2024-08-02 12:06:31.544 - info: admin.0 (936442) ==> Connected system.user.admin from ::ffff:XXXX.XXX.XX.X 2024-08-02 12:06:58.373 - info: javascript.0 (1115673) Stopping script script.js.test3 2024-08-02 12:08:26.276 - info: javascript.0 (1115673) Stopping script script.js.test_script2 2024-08-02 12:08:33.426 - info: javascript.0 (1115673) Start JavaScript script.js.test_script2 (Javascript/js) 2024-08-02 12:08:33.443 - info: javascript.0 (1115673) script.js.test_script2: registered 2 subscriptions, 0 schedules, 0 messages, 0 logs and 0 file subscriptions 2024-08-02 12:08:33.446 - debug: telegram.0 (1119202) Received command "ask": {"text":"Are you sure?","reply_markup":{"inline_keyboard":[[{"text":"Yes!","callback_data":"1"}],[{"text":"No...","callback_data":"0"}]]}} 2024-08-02 12:08:33.450 - debug: telegram.0 (1119202) Send message to [Steffen]: "Are you sure?" 2024-08-02 12:08:33.453 - debug: telegram.0 (1119202) Send message to [Sabine]: "Are you sure?" 2024-08-02 12:08:33.509 - debug: telegram.0 (1119202) Request [saveSendRequest]: {"message_id":84345,"from":{"id":XXXXXXXXX,"is_bot":true,"first_name":"IoBroker","username":"XXXXX_XXXXXXXXX_Bot"},"chat":{"id":XXXXXXXXX,"first_name":"Steffen","username":"XXXXXXXX","type":"private"},"date":1722593313,"text":"Are you sure?","reply_markup":{"inline_keyboard":[[{"text":"Yes!","callback_data":"1"}],[{"text":"No...","callback_data":"0"}]]}} 2024-08-02 12:08:33.510 - debug: telegram.0 (1119202) Message sent 2024-08-02 12:08:33.522 - debug: telegram.0 (1119202) Request [saveSendRequest]: {"message_id":84346,"from":{"id":XXXXXXXXXX,"is_bot":true,"first_name":"IoBroker","username":"XXXXX_XXXXXXXXX_Bot"},"chat":{"id":XXXXXXXXXX,"first_name":"XXXXX","last_name":"XXXXXX","username":"XXXXX","type":"private"},"date":1722593313,"text":"Are you sure?","reply_markup":{"inline_keyboard":[[{"text":"Yes!","callback_data":"1"}],[{"text":"No...","callback_data":"0"}]]}} 2024-08-02 12:08:33.522 - debug: telegram.0 (1119202) Message sent 2024-08-02 12:08:33.523 - debug: telegram.0 (1119202) added question: {"cb":{"message":{"text":"Are you sure?","reply_markup":{"inline_keyboard":[[{"text":"Yes!","callback_data":"1"}],[{"text":"No...","callback_data":"0"}]]}},"id":11,"ack":false,"time":1722593313443},"from":"system.adapter.javascript.0","ts":1722593444447,"chatId":"2845182","user":"Steffen","msgId":84345} - answer timeout: 240000 2024-08-02 12:08:39.636 - info: admin.0 (936442) <== Disconnect system.user.admin from ::ffff:192.168.10.2 javascript 2024-08-02 12:08:53.454 - debug: telegram.0 (1119202) Received command "send": {"text":"Die Antwort war Nein","chatId":232821635} 2024-08-02 12:08:53.454 - debug: telegram.0 (1119202) Send message to [chat]: "Die Antwort war Nein" 2024-08-02 12:08:53.537 - debug: telegram.0 (1119202) Request [saveSendRequest]: {"message_id":84347,"from":{"id":XXXXXXXXXX,"is_bot":true,"first_name":"IoBroker","username":"Steffens_XXXXXXXXXXXXXX_Bot"},"chat":{"id":XXXXXXXXXX,"first_name":"Steffen","username":"xxxxxxxxxx","type":"private"},"date":1722593333,"text":"Die Antwort war Nein"} 2024-08-02 12:08:53.538 - debug: telegram.0 (1119202) Message sent

@peoples0815
Copy link
Author

Wenn man das Beispiel aus der Doku verwendet:
sendTo('telegram.0', 'ask', { user: user, // optional text: 'Are you sure?', reply_markup: { inline_keyboard: [ // two buttons could be on one line too, but here they are on different [{ text: 'Yes!', callback_data: '1' }], // first line [{ text: 'No...', callback_data: '0' }] // second line ] } }, msg => { console.log('user says ' + msg.data); });

kommt auch ein Fehler:
host.IoBroker 2024-08-16 07:23:46.314 info instance system.adapter.telegram.0 in version "3.9.0" started with pid 50831 host.IoBroker 2024-08-16 07:23:44.712 info Restart adapter system.adapter.telegram.0 because enabled host.IoBroker 2024-08-16 07:23:44.712 error instance system.adapter.telegram.0 terminated with code 6 (UNCAUGHT_EXCEPTION) telegram.0 2024-08-16 07:23:44.082 warn Terminated (UNCAUGHT_EXCEPTION): Without reason telegram.0 2024-08-16 07:23:44.081 info terminating telegram.0 2024-08-16 07:23:43.577 error Exception-Code: ETELEGRAM: ETELEGRAM: 400 Bad Request: message to edit not found telegram.0 2024-08-16 07:23:43.577 error Error: ETELEGRAM: 400 Bad Request: message to edit not found at /opt/iobroker/node_modules/node-telegram-bot-api/src/telegram.js:316:15 at tryCatcher (/opt/iobroker/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/opt/iobroker/node_modules/bluebird/js/release/promise.js:547:31) at Promise._settlePromise (/opt/iobroker/node_modules/bluebird/js/release/promise.js:604:18) at Promise._settlePromise0 (/opt/iobroker/node_modules/bluebird/js/release/promise.js:649:10) at Promise._settlePromises (/opt/iobroker/node_modules/bluebird/js/release/promise.js:729:18) at _drainQueueStep (/opt/iobroker/node_modules/bluebird/js/release/async.js:93:12) at _drainQueue (/opt/iobroker/node_modules/bluebird/js/release/async.js:86:9) at Async._drainQueues (/opt/iobroker/node_modules/bluebird/js/release/async.js:102:5) at Async.drainQueues [as _onImmediate] (/opt/iobroker/node_modules/bluebird/js/release/async.js:15:14) at process.processImmediate (node:internal/timers:483:21) telegram.0 2024-08-16 07:23:43.577 error unhandled promise rejection: ETELEGRAM: 400 Bad Request: message to edit not found telegram.0 2024-08-16 07:23:43.576 error Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). admin.0 2024-08-16 07:23:32.504 info <== Disconnect system.user.admin from ::ffff:192.168.10.2 javascript admin.0 2024-08-16 07:23:32.504 info <== Disconnect system.user.admin from ::ffff:192.168.10.2 javascript admin.0 2024-08-16 07:23:30.991 info ==> Connected system.user.admin from ::ffff:192.168.10.2 admin.0 2024-08-16 07:23:22.695 info ==> Connected system.user.admin from ::ffff:192.168.10.2 javascript.0 2024-08-16 07:22:58.180 info script.js.test: user says undefined javascript.0 2024-08-16 07:22:38.180 info script.js.test: registered 2 subscriptions, 0 schedules, 0 messages, 0 logs and 0 file subscriptions javascript.0 2024-08-16 07:22:38.165 info Start JavaScript script.js.test (Javascript/js) javascript.0 2024-08-16 07:22:21.707 info Stopping script script.js.test

@Dome2075
Copy link

Hi,
same issue.

response always trigger after 20 seconds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants