使用 discourse-chat-integration 插件设置 Telegram 集成

Solved: Exited the chat bot from that telegram group. And understood that if I wanted the bot to be the part of that group, then that group’s chat ID need to have a channel and a channel rule under itself.

1 个赞

The Telegram integration works very well for channels but it’s unsuitable for groups-- it will spam its operation instructions every time a chat “event” happens (like someone joining or leaving the chat, or a message getting pinned). Even if you disable the slash commands entirely. Is there a way to get the bot to not respond to these events?

2 个赞

Do you have group_privacy disabled?

4 个赞

I tried that setting too and saw that it becomes every message as you say. Even with group_privacy enabled bots can still see these join/leave/pin events.

Hi,
I created the telegram bot, entered the key and activated the function in discourse. HTTPS is enabled (our site runs behind an apache proxy)
However the tab is not showing. Where can I debug this? I can not find any errors in the logs.
Is there a way to test the connection to telegram from inside the Discourse container?
thx

1 个赞

short update on this. I entered the discourse container with docker exec -it container /bin/bash. then I executed the following:

curl https://api.telegram.org/bot123456789:ABCDEfgh2ZojwyChMz0xuIo2Wvg4ww3XGI4g/getMe

this returned an ok response with the name of my bot etc.

however the integration with discourse does not work yet. Is there a log file somewhere so that I can debug this? Any help is appreciated.

Is the force_https site setting enabled? Is the chat_integration_enable_telegram setting enabled?

2 个赞

Hi,
yes both settings are enabled.
HTTPS is working fine, also with login integration with fb, google, tw.

what could be the cause, or where could I find the logs?

thx

@jucajuca

I am also facing same issue since last 4-5 days on my new discourse instance.

Hi @david, is there any way i can see the logs.

On my old instance notifications are working good with telegram bot, but in newer instance Chat ID is not getting generated. The curl command mentioned above is giving output as true from discourse instance. Other oauth plugins like google. twitter are working without any issues.

Thanks in advance.

1 个赞

I just got it working on a new Discourse install by firing up rails c and manually running DiscourseChat::Provider::TelegramProvider.setup_webhook()

Hope that helps!

4 个赞

Thanks a lot @codatory
@codinghorror Thanks for this awesome platform :slight_smile:

It worked :+1:

2 个赞

can you elaborate a bit on this? should I run these commands from within the container? in which directory? I’m not a rails expert. thx! : )

Yeah; so you enter the container and run
rails c
Then wait a bit for it to load up. Once it’s loaded up you can paste in
DiscourseChat::Provider::TelegramProvider.setup_webhook(); exit
Then you can exit out of the container and it should be working.

2 个赞

THANK YOU, this solved my issue But had to toggle the plugin off in my admin. Then on. Then run this.

1 个赞

我已经能让它正常工作,但仅限于个人对话,无法在群组中运行。它会直接向我发送通知,就像我和机器人之间的聊天一样。

我已将机器人添加到私人群组中,并且机器人拥有该群组的管理员权限。同时,我已在 Discourse 插件设置中将此群组添加为频道。然而,每当我尝试向该群组(Telegram 频道)发送测试通知时,都会收到 422 错误。无论我怎么做都无法解决。该错误来自 Discourse Telegram 插件的频道设置内部。

有人能帮忙吗?我们真的很想为群组完成此设置。

感谢此 PR,该问题现已解决:

最常见的问题是 API 密钥无效。请确保您正确复制并粘贴了密钥,且未意外在前后添加任何空格。

2 个赞

API 令牌工作正常,我可以收到 Telegram 机器人发来的私信通知。但它无法发送到群组。此外,每当频道中有人发送消息时,机器人就会显示“此频道已设置 chatID: …

现在我遇到了这个错误。

Errno::ECONNRESET: 连接被对端重置 - SSL_connect
来自 /usr/local/lib/ruby/2.6.0/net/protocol.rb:44:in `connect_nonblock’

无论怎样切换此设置,我都会遇到同样的问题。这里有变通方法吗?

我试图设置通知,但当我将机器人添加到 Telegram 群组时,它没有发送聊天 ID。我多次尝试但每次都失败了 :<

我该如何排查这个问题?我已经尝试过运行 rails console 命令

1 个赞