File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -109,16 +109,30 @@ async def is_writer(interaction: discord.Interaction) -> bool:
109109 Returns:
110110 bool: True if the user can run, False if they cannot
111111 """
112- await is_reader (interaction )
113112 config = interaction .client .guild_configs [str (interaction .guild .id )]
114- if reader_roles := config .extensions .notes .note_writers .value :
113+ reader_roles = config .extensions .notes .note_readers .value
114+ writer_roles = config .extensions .notes .note_writers .value
115+
116+ try :
117+ await is_reader (interaction )
118+ except app_commands .MissingAnyRole :
119+ raise app_commands .MissingAnyRole (reader_roles )
120+ except app_commands .AppCommandError :
121+ message = "There aren't any `note_readers` roles set in the config!"
122+ embed = auxiliary .prepare_deny_embed (message = message )
123+
124+ await interaction .response .send_message (embed = embed , ephemeral = True )
125+
126+ raise app_commands .AppCommandError (message )
127+
128+ if writer_roles :
115129 roles = (
116130 discord .utils .get (interaction .guild .roles , name = role )
117- for role in reader_roles
131+ for role in writer_roles
118132 )
119133 status = any ((role in interaction .user .roles for role in roles ))
120134 if not status :
121- raise app_commands .MissingAnyRole (reader_roles )
135+ raise app_commands .MissingAnyRole (writer_roles )
122136 return True
123137
124138 # Reader_roles are empty (not set)
You can’t perform that action at this time.
0 commit comments