Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit 3cc78e5

Browse files
committed
Limit Discord integration to select guilds
1 parent 6aeb576 commit 3cc78e5

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

app/controllers/discourse_ai/discord/bot_controller.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,14 @@ def interactions
2222
# Respond to Discord PING request
2323
render json: { type: 1 }
2424
else
25+
unless SiteSetting.ai_discord_allowed_guilds_map.include?(interaction.guild_id)
26+
return head :forbidden
27+
end
2528
response = { type: 5, data: { content: "Searching..." } }
2629
hijack { render json: response }
2730

31+
Rails.logger.info("Discord interaction received: #{body}")
32+
2833
# Respond to Discord command
2934
Jobs.enqueue(:stream_discord_reply, interaction: body.dup)
3035
end

config/settings.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,3 +448,7 @@ discourse_ai:
448448
default: ""
449449
type: enum
450450
enum: "DiscourseAi::Configuration::PersonaEnumerator"
451+
ai_discord_allowed_guilds:
452+
type: list
453+
list_type: compact
454+
default: ""

0 commit comments

Comments
 (0)