Ok, I fixed this.
The bridge plugin has is now compatible with the latest discourse test-passed version.
I’m looking forward to it supporting QQ afterwards
As I understand from the latest messages in the topic: the plugin is functioning. Please tell me if I am right in this assumption.
May I ask if this plugin works with telegram themes (chat sections)?
Thank you very much for your work
Welcome to Meta
The latest posts were written before the latest edit to the first post, where the broken tag was added, happened.
So, I would expect that it’s still broken.
I’m glad to announce that this plugin is now compatible agian with the latest version of Discourse
love this. I dont use Telegram, but I love the opportunity that this project will allow us to integrate with Matrix finally <3
Is there a way to obtain logs of the plugin? @Lhc_fl
I’m trying to figure out why it only works one way (Discourse → Telegram). Bot of course has permission to access group messages. There are no apparent logs in the console
Edit: was trying to troubleshoot this, and seemingly it is basically impossible to get proper logs in production.
Not even errors or warnings related to the plugin are logged in production.log / production_error.log.
I’m suspecting some webhook related issue, and from the looks the plugin doesn’t get deactivated on errors?
As it works one way the credentials provided are definitely correct. If someone has an idea how to obtain the logs written by the plugin, please let me know.
It’s just supressing INFO and DEBUG, I’m pretty confident that Rails.logger.error
will leave error logs in production Other logs are by design not supposed to appear in production.
I wrote this plugin a long time ago, maybe I should probably check its webhook logic.
Try accessing this URL in your browser and see what the output is?
https://api.telegram.org/bot{token}/setWebhook?url=https://your.discourse.site/chat-bridge/telegram/hook/123456
Replace {token}
with your bot token.
If the webhook is set up correctly, it should receive a ok message.
Yep, I can confirm that this works:
{"ok":true,"result":true,"description":"Webhook was set"}
That’s strange. And if the creation of the message fails, the error log will be printed here, you should be able to see it in https://your.discourse.site/logs
Could it really be a permissions issue? If reply directly to the bridged message created by the telegram bot, will it succeed?
I’m in fact seeing now a few logs related to the module in /logs:
[Discourse -> Telegram] Failed in chat_message_created:
Inspecting ChatBridgeModule::Provider::Telegram::Services::HandleDiscourseMessage result object:
[1/8] [params] default (0.0555 ms) ✅
[2/8] [model] bot (0.0178 ms) ✅
[3/8] [step] ensure_bot_valid ❌
(5 more steps not shown as the execution flow was stopped before reaching them)
Why it failed:
INVALID_BOT
activesupport-7.2.2.1/lib/active_support/broadcast_logger.rb:130:in `block in warn'
activesupport-7.2.2.1/lib/active_support/broadcast_logger.rb:231:in `block in dispatch'
activesupport-7.2.2.1/lib/active_support/broadcast_logger.rb:231:in `each'
activesupport-7.2.2.1/lib/active_support/broadcast_logger.rb:231:in `dispatch'
activesupport-7.2.2.1/lib/active_support/broadcast_logger.rb:130:in `warn'
/var/www/discourse/plugins/discourse-chat-bridge/lib/chat_bridge_module/provider/telegram/bridge.rb:51:in `block (3 levels) in <main>'
/var/www/discourse/lib/scheduler/defer.rb:125:in `block in do_work'
rails_multisite-6.1.0/lib/rails_multisite/connection_management/null_instance.rb:49:in `with_connection'
rails_multisite-6.1.0/lib/rails_multisite/connection_management.rb:21:in `with_connection'
/var/www/discourse/lib/scheduler/defer.rb:119:in `do_work'
/var/www/discourse/lib/scheduler/defer.rb:105:in `block (2 levels) in start_thread'
But thats from yesterday and didn’t repeat afterwards, so I’m assuming it had to do with adding the bot and not meeting all requirements yet. After that, nore more bridge plugin logs. Unless, of course, that caused it to never work after that
No, that does not work.
I wonder whether its possible to look into the secret created by the plugin, as this would allow manual creation?
I just noticed one thing while looking through Nginx logs (as the webhook call must occur here)
[26/Jan/2025:12:05:39 +0000] "forum.xyz.org" 91.108.5.109 "POST /chat-bridge/telegram/hook/123456 HTTP/1.1" "-" "chat_bridge_module/telegram_webhook/hook" 403 5865 "-" 0.009 0.010 "-" "-" "-" "-" "-" "-" "-"
That’s the webhook I manually created earlier right?
… and we are one step further. I manually set the secret path via rails console and adapted the webhook manually. POST request to Discouse now succeeds. And now there is an actual error:
/var/www/discourse/plugins/discourse-chat-bridge/lib/chat_bridge_module/provider/telegram/services/handle_tg_message.rb:110:in `message_creation_succeed'
/var/www/discourse/lib/service/base.rb:156:in `instance_exec'
/var/www/discourse/lib/service/base.rb:156:in `run_step'
/var/www/discourse/lib/service/base.rb:199:in `run_step'
/var/www/discourse/lib/service/base.rb:139:in `block in call'
/var/www/discourse/lib/service/base.rb:165:in `with_runtime'
/var/www/discourse/lib/service/base.rb:139:in `call'
/var/www/discourse/lib/service/base.rb:457:in `block in run!'
/var/www/discourse/lib/service/base.rb:457:in `each'
/var/www/discourse/lib/service/base.rb:457:in `run!'
/var/www/discourse/lib/service/base.rb:450:in `run'
<internal:kernel>:90:in `tap'
/var/www/discourse/lib/service/base.rb:302:in `call'
/var/www/discourse/plugins/discourse-chat-bridge/lib/chat_bridge_module/provider/telegram/bridge.rb:9:in `block (3 levels) in <main>'
/var/www/discourse/lib/scheduler/defer.rb:125:in `block in do_work'
rails_multisite-6.1.0/lib/rails_multisite/connection_management/null_instance.rb:49:in `with_connection'
rails_multisite-6.1.0/lib/rails_multisite/connection_management.rb:21:in `with_connection'
/var/www/discourse/lib/scheduler/defer.rb:119:in `do_work'
/var/www/discourse/lib/scheduler/defer.rb:105:in `block (2 levels) in start_thread'
Job exception: In params.message creation: Inspecting Chat::CreateMessage result object:
[ 1/28] [options] default (0.0168 ms) ✅
[ 2/28] [policy] no_silenced_user (0.0148 ms) ✅
[ 3/28] [policy] accept_blocks (0.0051 ms) ✅
[ 4/28] [params] default (0.0742 ms) ✅
[ 5/28] [model] channel (0.7018 ms) ✅
[ 6/28] [step] enforce_membership (0.013 ms) ✅
[ 7/28] [model] membership ❌
(21 more steps not shown as the execution flow was stopped before reaching them)
Why it failed:
/var/www/discourse/lib/service/base.rb:184:in `run_step': Model not found (ArgumentError)
raise ArgumentError, "Model not found"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
from /var/www/discourse/lib/service/base.rb:139:in `block in call'
from /var/www/discourse/lib/service/base.rb:165:in `with_runtime'
from /var/www/discourse/lib/service/base.rb:139:in `call'
from /var/www/discourse/lib/service/base.rb:457:in `block in run!'
from /var/www/discourse/lib/service/base.rb:457:in `each'
from /var/www/discourse/lib/service/base.rb:457:in `run!'
from /var/www/discourse/lib/service/base.rb:450:in `run'
from <internal:kernel>:90:in `tap'
from /var/www/discourse/lib/service/base.rb:302:in `call'
from /var/www/discourse/plugins/discourse-chat-bridge/lib/chat_bridge_module/provider/telegram/services/handle_tg_message.rb:91:in `fetch_message_creation'
from /var/www/discourse/lib/service/base.rb:156:in `instance_exec'
from /var/www/discourse/lib/service/base.rb:156:in `run_step'
from /var/www/discourse/lib/service/base.rb:182:in `run_step'
from /var/www/discourse/lib/service/base.rb:139:in `block in call'
from /var/www/discourse/lib/service/base.rb:165:in `with_runtime'
from /var/www/discourse/lib/service/base.rb:139:in `call'
from /var/www/discourse/lib/service/base.rb:457:in `block in run!'
from /var/www/discourse/lib/service/base.rb:457:in `each'
from /var/www/discourse/lib/service/base.rb:457:in `run!'
from /var/www/discourse/lib/service/base.rb:450:in `run'
from <interna...
But this looks more like a configuration issue I wonder why I need to adjust.
Oh, this is not expected, I guess I made a mistake here when adapting to the new version of Discourse. Will take a look at it
Thank you! Let me know if there is anything I can do to help.