discourse-chat-integration プラグインを使用した Telegram 連携の設定

この howto では、discourse-chat-integration に含まれる Telegram プロバイダの設定方法を説明します。

プラグインを有効にする

discourse-chat-integration プラグインは Discourse にバンドルされています。まだの場合は、メインのプラグイン手順に従って有効にしてください。

Telegram の設定

  1. Telegram の「Botfather」 :robot: に話しかけ、新しいボットを設定します。詳細な手順はこちら
  2. BotFather から提供される トークン を必ずコピーしてください。次のような形式になります。
    110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw
    

Discourse の設定

  1. サイトの設定で、先ほど取得した トークンchat integration telegram access token 設定に貼り付けて保存します。

  2. chat_integration_telegram_enabled 設定を有効にして保存します。

  3. プラグイン タブに移動し、チャット統合 に移動します。

  4. Telegram タブに移動します。

    • 注意: Telegram タブが表示されない場合は、API への接続で何らかの問題が発生しています。サイトログを確認し、chat_integration_telegram_enabled 設定を再度有効にしてからやり直してください。

チャンネルの追加

  1. ボットをテレグラムのグループチャットに追加する(またはプライベートチャットを開始する)。

  2. ボットに何かメッセージを送信する(またはボットが追加されたグループチャットでメッセージを送信する)。Chat ID を含むメッセージが届くはずです。/getchatid から始まるメッセージを送信することもできます。

  3. Chat ID をコピーします。前にマイナス記号がある場合は、必ず含めてください。これは非常に重要です!

  4. Discourse の管理パネルの プラグインチャット統合Telegram に移動します。

  5. チャンネルを追加 をクリックします。

  6. チャンネルの名前を入力します(これは Discourse の管理パネルにのみ表示され、任意の名前にできます)。

  7. 先ほどの Chat ID をボックスに貼り付け、チャンネルを保存 をクリックします。

  8. 作成したチャンネルの テスト ボタンを使用して、すべてが機能しているか確認します。次のような表示があるはずです。

  9. discourse-chat-integration の手順に従って、チャンネルの「ルール」を設定します。

  10. すべての通知をお楽しみください :allthethings:

ブロードキャストチャンネルでの使用

Telegram のブロードキャストチャンネルに通知を送信するには、ボットをチャンネル管理者に設定し、メッセージとして

/getchatid

を送信してチャット ID を取得します。その後、上記の指示に従って Discourse に設定します。公開チャンネルの場合は、数値のチャット ID の代わりに @channelname 形式(例: @myforumchannel)を使用することもできます。

ブロードキャストチャンネルでは、スラッシュコマンドを使用してルールを管理することはできません。

スラッシュコマンド

「スラッシュコマンド」を使用して、Telegram からルールを制御できます。サイト設定の chat integration telegram enable slash commands が有効になっていることを確認してください。これは、グループチャットで投稿できるすべての人にルールの編集権限を与えることに注意してください。

使用方法については、/help (グループチャット内の場合は /help@my-forum-bot)を送信するだけで、ボットがヘルプメッセージを送信します。

コマンドのオートコンプリートの設定(必須ではありませんが、使用が格段に容易になります)

  1. Telegram BotFather :robot: に話しかけます。
  2. ボットを選択し、ボットを編集 をクリックし、次に コマンドを編集 をクリックします。
  3. コマンドのリストをコピーして貼り付けます
    watch - [category] [tag:name] | このチャンネルの新しいトピックとルールに一致する新しい返信について通知する
    follow - [category] [tag:name] | このチャンネルのルールに一致する新しいトピックについて通知する
    mute - [category] [tag:name] | ルールに一致する投稿への通知をこのチャンネルでブロックする
    remove - [rule number] | ルールを削除する(番号は /status を参照)
    status - このチャンネルのすべてのルールをリスト表示する
    help - ヘルプメッセージを表示する
    
  4. 成功メッセージが表示されるはずです :slight_smile:

その他のボットのカスタマイズ

Telegram BotFather :robot: に話しかけて、ボットの名前、説明、アイコンをカスタマイズします。ボットがグループチャット内のすべてのメッセージに返信しようとするのを防ぐため、「グループプライバシー」は有効のままにしておく必要があります。

「いいね!」 27

Isn’t possible to allow users to subscribe to any public category? Without asking an admin to add their id to the whitelist?

「いいね!」 1

Not currently. It is possibly something that could be added (this is how Slack works), but given there is no concept of “organisations” on telegram, we would need to be careful that only public-facing categories are visible.

For per-user stuff you could try the telegram-notifications-plugin

「いいね!」 1

But that means two different bots :sweat_smile:
Anyway, thanks for such good plugins :+1:

「いいね!」 1

I’ve set it up, and it works with bot itself. However, when I set it up for public channel and try to test, an error “422 No Reason Phrase” occurs.
Could someone help me out?

Where does this error occur? In telegram, or in the “test” dialog in the Discourse admin panel?

Hi! I don’t see any submenu in the admin panel to manage Telegram settings

But i got my chat ID through the bot.

Hello,
Can you tell me what different Telegram notifications using the discourse-chat-integration plugin and Telegram Notifications Plugin (discourse-telegram-notifications)

Check the very top of this topic: Telegram Notifications Plugin (discourse-telegram-notifications) (the part with the :warning: next to it)

「いいね!」 2

Whenever users reply to the Telegram bot message, it keeps informing them of the current chat ID, telling them to configure something different on the admin panel.

I have the actual message in Portuguese:

Este chat está configurado WTTD Fórum. Configure-o no painel de administração. (ID do bate-papo:-1001093143218)

Google translated:

This chat is configured for WTTD Forum. Configure it in the administration panel. (Chat ID: -1001093143218)

It’s quite annoying.

Also, I’ve disabled chat integration telegram enable slash commands, but it still replies with the command list.

Is there a way to make the bot ignore any reply?

where can we Add the channel in discourse? we don’t find nothing… caht bot is active and we get also the Chat-ID, thanks in advance

「いいね!」 1

After enabling the telegram site settings, head to your admin panel, click “plugins” at the top, then “chat integration” on the left.

「いいね!」 3

Hello, i don’t know is it ok right now, but after setting up bot in admin and adding bot to channel nothing happened.

Did you try using the “test channel” button. Did you get any errors?

「いいね!」 1

test channel button works, but i expect ‘welcome’ message like in guide.

I’m not sure which guide you are talking about. The chat-integration plugin doesn’t send a welcome message.

Once you have configured the channel, you need to add some “rules”. Then, topics/posts you make on your discourse forum will appear in Telegram.

「いいね!」 1

私はこの手順について話しています。

「いいね!」 1

Ah, I see. Try sending a message in the group, including the bot’s username (like @myforumbot). Then it should respond with that message.

「いいね!」 3

I’ve configured everything successfully, except that whenever a new member leaves/adds into the telegram group which has the ‘chat integration bot’ as one of this groups member, I receive this msg in the telegram group:

New rule: /[watch|follow|mute] [category] [tag:name]
(you must specify a rule type and at least one category or tag)

  • watch – notify this channel for new topics and new replies
  • follow – notify this channel for new topics
  • mute – block notifications to this channel

Remove rule: /remove [rule number]
([rule number] can be found by running /status)

List rules: /status

Help: /help

This msg has started irritating every time a member is added or removed into/from the telegram group.
And if I create a telegram broadcast/channel and add the chat integration bot into that, this problem doesn’t arise therein.