Update information.py so it's a bit cleaner#740
Conversation
|
Hello, thanks for the contribution! A couple general requests before we open this up to a broader review:
And some more specific top-level reads:
|
This reverts commit ab17ccc.
…he amount of channels & statuses.
|
Hi - Thank you for the feedback, and apologies for the issues and commit-spam. I do admit I'm not the most experienced with git, so I apologize for the forking mistake and commit spam that has happened. Would you like this PR to be re-created so the commit history is not as messy? As to your code requests:
I can understand and do agree the change of constants being unnecessary, though. Would you like the constants to be reverted, or all of the import changes (e.g. the two ones I mentioned above)?
This has been reverted, apologies.
I'm not sure if I completely understand this. I've never worked with Edit: On another note, I have zero clue why that check is failing. This works locally, and I have zero clue why |
|
No worries, it's all a learning experience. If you wouldn't mind, let's start from scratch & on a new branch so your Regarding the failing test, it's an issue with how we're mocking a member list for the test: bot/tests/bot/cogs/test_information.py Lines 127 to 131 in ca0ee4a With the old logic in the information cog, using strings rather than discord.py's |
|
Awesome, I will create a new PR once it is ready. Thank you for the valuable feedback so far. :) |
Hello! I was looking a bit around, and I stumbled over the
information.py cog. I found a couple of things that I thought could be improved a slight bit, and went ahead and gave it a shot. If there are any further changes you would like me to make for this PR, please let me know and I will go ahead and do so 😁Here’s a list of changes that I made:
@everyoneor not, I simply usectx.guild.roles[1:]instead, which skips the@everyonerole. This was used in a couple of places, so it should generally be cleaner.!rolecommand, if the user parsed in a role that didn’t exist/couldn’t be converted, the bot would send a message and continue to the next role that the user entered. If the user entered 5 wrong roles, the bot would send 5 messages- and it could become spammy. Instead, all messages are parsed first, and if there were any roles that couldn’t be converted, the bot lets the user know in 1 message..__class__attribute in a dict in order to get the text, voice and category channel count, instead of having a variable for each and if statements for each.Thank you for giving this PR a read! I look forward to hearing your feedback. 😄