wrightedu / CSE-Discord-Bot

Discord bot for the WSU CSE Discord server
GNU General Public License v3.0
2 stars 4 forks source link

Fixed #286 to log role name instead of role ID #298

Closed BPennie03 closed 4 months ago

BPennie03 commented 7 months ago

Description

I changed the calls for role_mention in the bottom 2 conditional checks for the role to instead be role.name for better logs readability. I did not have to change the first one (shown in the below code) as the role variable is not yet defined, so it would cause errors.

try:
    int(role_mention[3:-1])
except ValueError:
    await interaction.channel.send("The `role_mention` parameter can only take role mentions (i.e. of format `@role`).")
    await log(self.bot, f"{interaction.user} tried clearing the '{role_mention}' role in #{interaction.channel} but failed because of an invalid role mention")
    return

Issues

Closes #286

Type of change

Select one or more of the following:

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. List any edge cases you tested. If you come up with any edge cases you didn't test while writing this PR, cancel the PR and test again.

Checklist: