aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeLines
...
| | | | | | | * | | | | | Move counting of channels to a separate methodGravatar MarkKoz2020-05-30-10/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This de-clutters the main `server_info` function and improves its readability.
| | | | | | | * | | | | | 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.
| | | | | * / / / / Stats: Implement rules statsGravatar ks1292020-06-05-0/+3
| |_|_|_|/ / / / / |/| | | | | | | | | | | | | | | | | Increase every shown rule uses count when command called.
| | | | | | * | | Fix exception message assertions in converter testsGravatar MarkKoz2020-04-28-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `msg` arg is for displaying a message when the assertion fails. To match against the exception's message, `assertRaisesRegex` must be used. Since all of the messages are meant to be interpreted literally rather than as regex, `re.escape` is used.
| | | | | | * | | Use await instead of asyncio.run in converter testsGravatar MarkKoz2020-04-28-28/+27
| | | | | | | | |
| | | | | | * | | Remove redundant parenthesis from test valuesGravatar MarkKoz2020-04-28-19/+19
| | | | | | | | |
| | | | | | * | | Test for out of range datetime in the Duration converterGravatar MarkKoz2020-04-28-0/+11
| | | | | | | | |
| | | | | | * | | Converters: handle ValueError when year for duration is out of rangeGravatar MarkKoz2020-04-25-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `datetime` objects only support a year up to 9999. Fixes #906
| | | | | | | * | Filtering: Add user avatar thumbnail to nickname alert embedGravatar ks1292020-06-11-1/+2
| | | | | | | | |
| | | | | | | * | Filtering: Use walrus for better looking of codeGravatar ks1292020-06-11-4/+2
| | | | | | | | |
| | | | | | | * | Filtering: Fix nickname filter alert sending spacesGravatar ks1292020-06-11-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: Joseph Banks <[email protected]>
| | | | | | | * | Filtering: Fix some commentsGravatar ks1292020-06-11-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: Joseph Banks <[email protected]>
| | | | | | | * | Remove redis namespace collision testGravatar MarkKoz2020-05-31-10/+0
| | | | | | | | |
| | | | | | | * | Remove redis namespace collision preventionGravatar MarkKoz2020-05-31-10/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When cogs reload, it would consider their namespace as a conflict with the original namespace. This feature will be removed as a fix until we come up with a better solution.
| | | | | | | * | Add logging for the bad nickname filterGravatar MarkKoz2020-05-31-0/+2
| | | | | | | | |
| | | | | | | * | Fix missing await in bad nickname filterGravatar MarkKoz2020-05-31-18/+17
| | | | | | | | |
| | | | | | | * | Filtering: Small fixesGravatar ks1292020-05-31-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Use UTC from timestamp - Rename name bad words checking function
| | | | | | | * | Filtering: Fix docstringGravatar ks1292020-05-31-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: Mark <[email protected]>
| | | | | | | * | Merge remote-tracking branch 'origin/bad-words-nick' into bad-words-nickGravatar ks1292020-05-31-4/+1
| | | | | | | |\ \
| | | | | | | | * | Filtering: Create lock in `__init__`Gravatar ks1292020-05-30-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move lock creation from `bad_words_in_name` to `__init__`
| | | | | | | * | | Filtering: Split name filtering to smaller functionsGravatar ks1292020-05-31-11/+24
| | | | | | | | | |
| | | | | | | * | | Filtering: On name filtering, replace Message with Embed as argumentGravatar ks1292020-05-31-7/+7
| | | | | | | | | |
| | | | | | | * | | Filtering: Add days between alerts as constantGravatar ks1292020-05-31-1/+3
| | | | | | | | | |
| | | | | | | * | | Filtering: Rename `bad_words_in_name` to `check_is_bad_words_in_name`Gravatar ks1292020-05-31-2/+2
| | | | | | | | | |
| | | | | | | * | | Filtering: Use POSIX instead ISO format to storage alert cooldownsGravatar ks1292020-05-31-3/+2
| | | | | | | |/ /
| | | | | | | * | Filtering: Refactor bad names checkingGravatar ks1292020-05-29-31/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Make `bad_words_in_name` and attach it to current `on_message`. - Implement `asyncio.Lock` to avoid race conditions. - Made that this first check is there matches and when there is, check for alert.
| | | | | | | * | Filtering: Implement bad words detection in nicknamesGravatar ks1292020-05-29-0/+41
| |_|_|_|_|_|/ / |/| | | | | | |
* | | | | | | | 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
| |\ \ \ \ \ \ \ \ | |/ / / / / / / / |/| | | | | | | |