aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeLines
* Simplify counting of staff channels and improve efficiencyGravatar MarkKoz2020-05-30-49/+26
| | | | | | | | | | Simplification comes from being able to access permissions as attributes on the overwrite object. This removes the need to iterate all permissions. Efficiency comes from checking all roles within a single iteration of all channels. This also removes the need to flatten and filter the channels afterwards, which required additional iterations.
* Merge branch 'master' into staff_count_serverGravatar Leon Sandøy2020-05-30-1/+1
|\
| * Merge pull request #972 from Numerlor/tag-encodingGravatar Mark2020-05-29-1/+1
| |\ | | | | | | Specify encoding when reading tag files
| | * Tags: explicitly use UTF-8 to read filesGravatar MarkKoz2020-05-30-1/+1
| |/ | | | | | | | | | | | | | | Not all operating systems use UTF-8 as the default encoding. For systems that don't, reading tag files with Unicode would cause an unhandled exception. (cherry picked from commit adc75ff9bbcf8b905bd78c78f253522ae5e42fc3)
* | Don't membership check in an itertools.chain.Gravatar Leon Sandøy2020-05-30-2/+2
| | | | | | | | | | | | | | We're using the set comprehension to prevent duplicates anyway, so flipping these back makes more sense. Also added a missing ctx and tested ok.
* | Prevent duplicates, and break into function.Gravatar Leon Sandøy2020-05-30-27/+32
| | | | | | | | | | | | | | | | | | | | - We're using a set comprehension and flipping the order for counting the number of channels that are both staff allow and @everyone deny. - We're breaking the staff channel count stuff into a separate helper function so it doesn't crowd the server_info() scope. These fixes are both to address the code review from @MarkKoz, thanks Mark.
* | Fix busted test_information test.Gravatar Leon Sandøy2020-05-30-4/+8
| | | | | | | | I wish this test didn't exist.
* | More precise staff-channel check.Gravatar Leon Sandøy2020-05-30-13/+53
| | | | | | | | | | | | | | | | | | | | We now check: - Does the @everyone role have explicit read deny permissions? - Do staff roles have explicit read allow permissions? If the answer to both of these are yes, it's a staff channel. By 'staff roles', I mean Helpers, Moderators or Admins.
* | Merge branch 'master' into staff_count_serverGravatar Leon Sandøy2020-05-30-0/+1
|\|
| * Merge pull request #965 from Akarys42/patch-1Gravatar Dennis Pham2020-05-29-0/+1
| |\ | | | | | | Ignore response when posting python news
| | * Merge branch 'master' into patch-1Gravatar Dennis Pham2020-05-29-31/+8
| | |\ | | |/ | |/|
| | * Ignore response when posting python newsGravatar Matteo Bertucci2020-05-29-0/+1
| | | | | | | | | Sometimes a mailing list user doesn't press respond correctly to the email, and so a response is sent as a separate thread. To keep only new threads in the channel, we need to ignore those.
* | | Adding staff member count to !server.Gravatar Leon Sandøy2020-05-30-4/+10
| | |
* | | Clean up channel counts and add staff channels.Gravatar Leon Sandøy2020-05-29-2/+22
|/ / | | | | | | | | | | Cleaning up a particularly dirty line by turning it into like 10 lines, and also adding the number of channels that are hidden to the `@everyone` role - which we're classifying as "Staff channels".
* | Merge pull request #966 from python-discord/sebastiaan/help-channels/ratelimitsGravatar Joseph Banks2020-05-29-31/+8
|\ \ | |/ |/|
| * Reduce the number of help channel name changesGravatar Sebastiaan Zeeff2020-05-29-29/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Discord has introduced a new, strict rate limit for individual channel edits that reduces the number of allow channel name/channel topic changes to 2 per 10 minutes per channel. Unfortunately, our help channel system frequently goes over that rate limit as it edits the name and topic of a channel on all three "move" actions we have: to available, to occupied, and to dormant. In addition, our "unanswered" feature adds another channel name change on top of the move-related edits. That's why I've removed the topic/emoji changing features from the help channel system. This means we now have a generic topic that fits all three categories and no status emojis in the channel names.
| * Fix `check_for_answer` breaking on missing cacheGravatar Sebastiaan Zeeff2020-05-29-2/+5
|/ | | | | | | | | | The `check_for_answer` method of the HelpChannels cog relies on the channel->claimant cache being available. However, as this cache is (currently) lost during bot restarts, this method may fail with a KeyError exception. I've used `dict.get` with an `if not claimant: return` to circumvent this issue.
* Merge pull request #947 from python-discord/redis_persistenceGravatar Sebastiaan Zeeff2020-05-28-182/+1061
|\ | | | | RedisCache - Data Persistence
| * Move the `self.redis_closed` into session create.Gravatar Leon Sandøy2020-05-28-1/+1
| |
| * Prevent a state where a coro could wait forever.Gravatar Leon Sandøy2020-05-28-2/+6
| | | | | | | | This addresses a review comment by @aeros.
| * Add custom exceptions for each error state.Gravatar Leon Sandøy2020-05-28-8/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The bot can get into trouble in three distinct ways: - It has no Bot instance - It has no namespace - It has no parent instance. These happen only if you're using it wrong. To make the test more precise, and to add a little bit more readability (RuntimeError could be anything!), we'll introduce some custom exceptions for these three states. This addresses a review comment by @aeros.
| * Make prefix consts private and more precise.Gravatar Leon Sandøy2020-05-28-9/+9
| |
| * Reduce complexity on some of the typestring stuff.Gravatar Leon Sandøy2020-05-28-31/+9
| | | | | | | | | | | | | | | | | | - Refactor error messages in _to_typestring and _from_typestring to just print the prefix tuples instead of that custom error string. - Create a RedisKeyOrValue type to simplify some annotations. - Simplify partialmethod calls. - Make the signatures for _to_typestring and _from_typestring one-liners - Fix a typo in the errors.
| * Merge branch 'master' into redis_persistenceGravatar Leon Sandøy2020-05-27-80/+154
| |\ | |/ |/|
* | Merge pull request #961 from ↵Gravatar Sebastiaan Zeeff2020-05-27-88/+161
|\ \ | | | | | | | | | | | | python-discord/moderation_commands_in_modmail_category Permit moderation commands in ModMail category
| * | Add some tests for `in_whitelist_check`.Gravatar Leon Sandøy2020-05-27-0/+48
| | |
| * | Remove the now deprecated in_channel_check.Gravatar Leon Sandøy2020-05-27-16/+0
| | | | | | | | | | | | | | | This check was no longer being used anywhere, having been replaced by in_whitelist_check.
| * | Merge branch 'master' into moderation_commands_in_modmail_categoryGravatar Joseph Banks2020-05-27-0/+1
| |\ \ | |/ / |/| |
* | | Add /r/FlutterDev to the guild invite whitelistGravatar Dennis Pham2020-05-26-0/+1
| | |
| * | Allow some commands to fail checks silently.Gravatar Leon Sandøy2020-05-27-2/+9
| | | | | | | | | | | | | | | | | | For example, we don't want the mod commands to produce any kind of error message when run by ordinary users in regular channels - these should have the perception of being invisible and unavailable.
| * | No redirect for mod management.Gravatar Leon Sandøy2020-05-27-0/+1
| | |
| * | Find + change all InWhitelistCheckFailure importsGravatar Leon Sandøy2020-05-27-9/+8
| | |
| * | Allow infraction management in modmail categoryGravatar Leon Sandøy2020-05-27-12/+13
| | |
| * | Refactor the in_whitelist deco to a check.Gravatar Leon Sandøy2020-05-27-53/+86
|/ / | | | | | | | | | | | | | | | | We're moving the actual predicate into the `utils.checks` folder, just like we're doing with most of the other decorators. This is to allow us the flexibility to use it as a pure check, not only as a decorator. This commit doesn't actually change any functionality, just moves it around.
| * Fix ATROCIOUS comment.Gravatar Leon Sandøy2020-05-27-3/+5
| | | | | | | | I should be shot.
| * Refactor typestring converters to partialmethods.Gravatar Leon Sandøy2020-05-27-30/+24
| | | | | | | | | | | | | | | | | | We're using functools.partialmethod to make the code a little cleaner and more readable here. Read more about them here: https://docs.python.org/3/library/functools.html#functools.partial https://docs.python.org/3/library/functools.html#functools.partialmethod
| * Floats are no longer permitted as RedisCache keys.Gravatar Leon Sandøy2020-05-27-43/+86
| | | | | | | | | | | | | | Also added a test for this. This is the DRYest approach I could find. It's a little ugly, but I think it's probably good enough.
| * Refactor .increment and add lock test.Gravatar Leon Sandøy2020-05-27-65/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The way we were doing the asyncio.Lock() stuff for increment was slightly problematic. @aeros has adviced us that it's better to just initialize the lock as None in __init__, and then initialize it inside the first coroutine that uses it instead. This ensures that the correct loop gets attached to the lock, so we don't end up getting errors like this one: RuntimeError: got Future <Future pending> attached to a different loop This happens because the lock and the actual calling coroutines aren't on the same loop. When creating a new test, test_increment_lock, we discovered that we needed a small refactor here and also in the test class to make this new test pass. So, now we're creating a DummyCog for every test method, and this will ensure the loop streams never cross. Cause we all know we must never cross the streams.
| * Clear cache in asyncSetUp instead of tests.Gravatar Leon Sandøy2020-05-27-6/+1
| |
| * Merge branch 'master' into redis_persistenceGravatar Leon Sandøy2020-05-26-24/+97
| |\ | |/ |/|
* | Merge pull request #866 from python-discord/restricted_tagsGravatar Shirayuki Nekomata2020-05-26-17/+42
|\ \ | | | | | | feature to restrict tags to specific role(s)
| * \ Merge branch 'master' into restricted_tagsGravatar Shirayuki Nekomata2020-05-26-955/+2577
| |\ \ | |/ / |/| |
* | | [stats] Do not report modmail channels to statsGravatar Joseph Banks2020-05-26-1/+11
| | |
* | | Merge pull request #936 from python-discord/bug/filters/929/invalid-invitesGravatar kwzrd2020-05-25-1/+3
|\ \ \ | | | | | | | | Filtering: don't attempt to send additional embeds for invalid invites
| * \ \ Merge branch 'master' into bug/filters/929/invalid-invitesGravatar kwzrd2020-05-25-594/+833
| |\ \ \ | |/ / / |/| | |
* | | | Add discord.gift to URL blacklist, closes #958Gravatar Joseph Banks2020-05-24-0/+1
| | | |
* | | | Merge pull request #956 from ks129/help-channels-deleteGravatar Sebastiaan Zeeff2020-05-24-5/+40
|\ \ \ \ | | | | | | | | | | Help System: Move dormant faster if help channel is empty
| * \ \ \ Merge branch 'master' into help-channels-deleteGravatar Sebastiaan Zeeff2020-05-24-8/+64
| |\ \ \ \ | |/ / / / |/| | | |
| * | | | HelpChannels: remove `is_dormant_message`Gravatar MarkKoz2020-05-22-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | At this point, it's just a thin wrapper to call another function. It's redundant.
| * | | | HelpChannels: move message None check inside `match_bot_embed`Gravatar MarkKoz2020-05-22-8/+2
| | | | | | | | | | | | | | | | | | | | | | | | | It was being done repeatedly outside the function so let's move it in to reduce redundancy.