diff --git a/config.edn b/config.edn index fa87c62..f1ae148 100644 --- a/config.edn +++ b/config.edn @@ -12,7 +12,6 @@ ; :radarr/rootfolder "" ; :sonarrr/language-profile "" ; :sonarr/rootfolder "" - ; :discord/role-id role_id ; :discord/max-results 10 ; :overseerr/default-id 1 ; :log-level :trace diff --git a/docs/configuration.md b/docs/configuration.md index 3322f55..39f212f 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -10,18 +10,16 @@ The first step in configuration is creating the bot in Discord itself. 4. Go to OAuth2 and under "OAuth2 URL Generator", enable `applications.commands` and `bot` 5. Copy the resulting URL and use as the invite link to your server -In the server for which you will use the bot, you have the option to restrict -the commands to a certain role. For this, you need to create a new role for -your users (or use an existing one). Then, grab that role id. +### Permissions -To do this: +As of Doplarr v3.5.0, we removed the ability to role-gate the bot via our +configuration file as Discord launched the command permissions system within the client itself. -1. Enable Developer Mode (User Settings -> Advanced -> Developer Mode) -2. Under your server settings, go to Roles, find the role and "Copy ID" - -!> Every user that you wish to have access to the slash commands needs to be assigned this role (even the server owner/admins). - -This is optional and by default the bot will be accessible to everyone on the server. +To access this, after adding the bot to your server, navigate to `Server Settings -> Integrations -> Doplarr (or whatever you named it) -> Manage` and +from there you can configure the channels for which the bot is active and who +has access to the bot. This is a lot more powerful than the previous system and +users of the previous `ROLE_ID`-based approach must update as Discord broke the +old system. ## Sonarr/Radarr @@ -42,7 +40,6 @@ web interface to Overseerr if you need more features. | Environment Variable (Docker) | Config File Keyword | Type | Default Value | Description | | ------------------------------ | ------------------------------ | ------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | | `DISCORD__MAX_RESULTS` | `:discord/max-results` | Integer | `25` | Sets the maximum size of the search results selection | -| `DISCORD__ROLE_ID` | `:discord/role-id` | Long | N/A | The discord role id for users of the bot (omitting this lets everyone on the server use the bot) | | `DISCORD__REQUESTED_MSG_STYLE` | `:discord/requested-msg-style` | Keyword | `:plain` | Sets the style of the request alert message. One of `:plain :embed :none` | | `SONARR__QUALITY_PROFILE` | `:sonarr/quality-profile` | String | N/A | The name of the quality profile to use by default for Sonarr | | `RADARR__QUALITY_PROFILE` | `:radarr/quality-profile` | String | N/A | The name of the quality profile to use by default for Radarr | diff --git a/src/doplarr/config.clj b/src/doplarr/config.clj index f9d3d8e..dc96305 100644 --- a/src/doplarr/config.clj +++ b/src/doplarr/config.clj @@ -25,7 +25,6 @@ :overseerr/default-id ; Discord :discord/token - :discord/role-id :discord/max-results :discord/requested-msg-style ; Doplarr diff --git a/src/doplarr/config/specs.clj b/src/doplarr/config/specs.clj index d961023..8c0f460 100644 --- a/src/doplarr/config/specs.clj +++ b/src/doplarr/config/specs.clj @@ -17,7 +17,6 @@ (spec/def :discord/token string?) ; --- Optional settings -(spec/def :discord/role-id pos-int?) (spec/def :discord/max-results (spec/int-in 1 26)) (spec/def :discord/requested-msg-style #{:none :plain :embed}) @@ -52,8 +51,7 @@ If you have configured one, make sure to check spelling. A valid configuration c ; Complete configuration (spec/def ::config (spec/and (spec/keys :req [:discord/token] - :opt [:discord/role-id - :discord/max-results + :opt [:discord/max-results :discord/requested-msg-style :radarr/quality-profile :sonarr/quality-profile diff --git a/src/doplarr/core.clj b/src/doplarr/core.clj index d611eb8..b22b880 100644 --- a/src/doplarr/core.clj +++ b/src/doplarr/core.clj @@ -43,11 +43,8 @@ (info "Connected to guild") (let [media-types (config/available-media @state/config) messaging (:messaging @state/discord) - bot-id (:bot-id @state/discord) - [{command-id :id}] (discord/register-commands media-types bot-id messaging id)] - (when (:discord/role-id @state/config) - (info "Setting role id. Reminder, even the server owner needs this role.") - (discord/set-permission bot-id messaging id command-id)))) + bot-id (:bot-id @state/discord)] + (discord/register-commands media-types bot-id messaging id))) (defmethod handle-event! :default [event-type data] diff --git a/src/doplarr/discord.clj b/src/doplarr/discord.clj index f454908..b98cb16 100644 --- a/src/doplarr/discord.clj +++ b/src/doplarr/discord.clj @@ -12,7 +12,6 @@ (defn request-command [media-types] {:name "request" :description "Request media" - :default_permission (boolean (not (:discord/role-id @state/config))) :options (into [] (for [media media-types] {:type 1 @@ -157,9 +156,3 @@ messaging bot-id guild-id [(request-command media-types)]) (else #(fatal % "Error in registering commands")))) - -(defn set-permission [bot-id messaging guild-id command-id] - (->> @(m/edit-application-command-permissions! - messaging bot-id guild-id command-id - [{:id (:discord/role-id @state/config) :type 1 :permission true}]) - (else #(fatal % "Error in setting command permissions"))))