fix: restrict bot to configured channel's threads + future tag-based triggering across repos
メンテナーはふだん 1 日以内に返信
@kpj2006 がすでに取り組んでいます。
2026年6月11日 から。
評価
この issue はまだ評価されていません。
説明
Summary
Currently the bot responds to messages in any thread across the entire server, not just threads that belong to the configured channel. This is a bug that needs to be fixed now, with a future enhancement to support tag-based triggering when the bot is deployed across multiple repos/servers.
Identified in: https://github.com/AOSSIE-Org/SkillBot/pull/6#discussion_r3393981241
Related PR: https://github.com/AOSSIE-Org/SkillBot/pull/6
Requested by: @kpj2006
Bug: Bot responds to ALL threads server-wide
Root Cause
In bot.py, the guard in process_message has a logic flaw:
is_in_thread = isinstance(message.channel, discord.Thread)
is_in_configured_channel = message.channel.id == DISCORD_CHANNEL_ID_INT
if not is_in_thread and not is_in_configured_channel:
return
When message.channel is a discord.Thread, its .id is the thread's own ID, not the parent channel's ID. The condition not is_in_thread and not is_in_configured_channel lets all threads pass regardless of which channel they belong to, because is_in_thread being True skips the channel ID check entirely.
Fix for Current Codebase
In bot.py, update the process_message function (around lines 169–173):
is_in_thread = isinstance(message.channel, discord.Thread)
- is_in_configured_channel = message.channel.id == DISCORD_CHANNEL_ID_INT
+ if is_in_thread:
+ is_in_configured_channel = message.channel.parent_id == DISCORD_CHANNEL_ID_INT
+ else:
+ is_in_configured_channel = message.channel.id == DISCORD_CHANNEL_ID_INT
- if not is_in_thread and not is_in_configured_channel:
+ if not is_in_configured_channel:
return
This uses message.channel.parent_id when the channel is a Thread, which correctly identifies the parent text channel.
Future Enhancement: Tag-based Triggering Across Repos
In a later phase, the bot will be deployed across multiple Discord servers/repos and should only respond when explicitly mentioned/tagged (e.g., @SkillBot <question>).
Changes needed when implementing this:
-
Add mention detection in
process_message:- Check if
client.useris mentioned inmessage.mentionsbefore processing. - Strip the mention prefix from the message content before passing it to Ollama.
- Check if
-
Remove or relax the single-channel restriction (
DISCORD_CHANNEL_ID_INTcheck):- Once tag-based triggering is in place, the bot can safely listen server-wide (or across guilds) since it only activates on explicit mentions.
-
Update
_get_or_create_thread:- Thread naming / parent channel logic may need to be generalized to work across any channel.
-
Update
.env/ configuration:DISCORD_CHANNEL_IDcan be made optional or replaced with a list of allowed channels/guilds.
-
Update
on_readybacklog processing:- Backlog catch-up should also filter by mentions to avoid re-processing unrelated messages.
- 主要言語
- Python
- スター
- 10
- フォーク
- 11
- 平均マージ
- 6分
- マージ済み PR(30日)
- 4
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
AOSSIE-Org/SkillBot のほかの issue
-
[BUG]: Issue-creation intent is missed when the article is omitted (create issue for this)対応中かも @Ankitavasudev が 8 日前に担当しました。 オープンbug enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
AOSSIE-Org/SkillBot#65 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[BUG]: Non-Atomic Gap Log Writes Can Cause Data Loss After an Interrupted Save再び着手できるかも @SYED-IRTEZA-HUSSAIN-RIZVI が 11 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンbug enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
AOSSIE-Org/SkillBot#61 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[BUG]: os.chdir() Changes the Process-Wide Working Directory During Repository Sync対応中かも @aadityachhipa80-oss が 2 日前に担当しました。 オープンbug enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
AOSSIE-Org/SkillBot#59 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
[BUG]: wait_for_ollama() Retries Indefinitely When Ollama Is Unavailable再び着手できるかも @SYED-IRTEZA-HUSSAIN-RIZVI が 11 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンbug enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
AOSSIE-Org/SkillBot#56 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
[BUG]: Backlog Messages Are Re-processed on Discord Reconnection再び着手できるかも @SYED-IRTEZA-HUSSAIN-RIZVI が 11 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンbug enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
AOSSIE-Org/SkillBot#58 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
AOSSIE-Org/SkillBot の issue をすべて見る
似ている issue
-
needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
gke-labs/kube-agents#6778 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Declare the CMS schema library in the optional recipients extra対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンarea:python in-progress
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
yhay81/pyropdf#1005 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
area/build-framework kind/enhancement priority/low
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
yugabyte/yugabyte-db#38826 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 72/100
sususweet/midea_auto_cloud#306 ·
メンテナーはふだん 9 日以内に返信