ChatGPT-in-Slack
ChatGPT-in-Slack copied to clipboard
Restrict bot usage to specific channels or users
Related to #32
Add access control feature to restrict bot usage to specific channels or users.
-
Environment Variables: Add
ALLOWED_CHANNELS
andALLOWED_USERS
environment variables inmain.py
andmain_prod.py
to specify allowed channels and users. -
Middleware: Update middleware in
main.py
andmain_prod.py
to check if the bot is allowed in the channel or by the user. -
Access Control Function: Add
is_bot_allowed
function inapp/bolt_listeners.py
to check if the bot is allowed to respond based on the specified channels and users. -
Event Handlers: Update
respond_to_app_mention
andrespond_to_new_message
inapp/bolt_listeners.py
to useis_bot_allowed
function. -
Documentation: Update
README.md
to include instructions on how to configure theALLOWED_CHANNELS
andALLOWED_USERS
environment variables.
For more details, open the Copilot Workspace session.