aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeLines
* Allow whitespace in duration strings and update testsGravatar Sebastiaan Zeeff2019-09-23-123/+87
| | | | | | | | | | | | | | | | | | | | | https://github.com/python-discord/bot/issues/446 After review feedback and a discussion in the dev-core team, I've changed a couple of things: - Allow a space between amount and unit in the duration string; - Allow a space between different units in the duration string; - Remove the old ExpirationDate converter completely; - Remove the dependency `dateparser` from the Pipfile; - Update tests for the two types of optional spaces; - Change the test for valid cases to a more readable format; This PR closes #446
* Fix failing duration conversionGravatar Sebastiaan Zeeff2019-09-23-18/+127
| | | | | | | | | | | | | | | | | | | https://github.com/python-discord/bot/issues/446 The current ExpirationDate converter does not convert duration strings to `datetime.datetime` objects correctly. To remedy the problem, I've written a new Duration converter that uses regex matching to extract the relevant duration units and `dateutil.relativedelta.relativedelta` to compute a `datetime.datetime` that's the given duration in the future. I've left the old `ExpirationDate` converter in place for now, since the new Duration converter may not be the most optimal method. However, given the importance of being able to convert durations for moderation tasks, I think it's better to implement Duration now and rethink the approach later. This commit closes #446
* Make DEFCON days subcommand enable DEFCON (#405)Gravatar scragly2019-09-23-66/+70
|\ | | | | | | | | | | Make DEFCON days subcommand enable DEFCON Co-authored-by: Joseph <[email protected]> Co-authored-by: null <[email protected]>
| * Merge branch 'master' into defcon-fix-djangoGravatar scragly2019-09-23-1708/+1066
| |\ | |/ |/|
* | Update linting (#406)Gravatar scragly2019-09-23-1708/+1066
|\ \ | | | | | | Update linting
| * | Apply suggestions from code reviewGravatar sco12019-09-22-235/+156
| | | | | | | | | | | | Co-Authored-By: Mark <[email protected]>
| * | Apply suggestions from code reviewGravatar S. Co12019-09-22-29/+39
| | | | | | | | | Co-Authored-By: Mark <[email protected]>
| * | Merge branch 'master' into flake8-pluginsGravatar sco12019-09-22-3/+3
| |\ \ | |/ / |/| |
| * | Apply suggestions from code reviewGravatar S. Co12019-09-22-3/+3
| | | | | | | | | Co-Authored-By: Leon Sandøy <[email protected]>
| * | Apply suggestions from code reviewGravatar sco12019-09-19-2/+2
| | | | | | | | | | | | Co-Authored-By: Sebastiaan Zeeff <[email protected]>
| * | Apply suggestions from code reviewGravatar S. Co12019-09-19-4/+4
| | | | | | | | | Co-Authored-By: Sebastiaan Zeeff <[email protected]>
| * | Update imports for applied code review suggestionsGravatar sco12019-09-19-4/+3
| | |
| * | Apply suggestions from code reviewGravatar S. Co12019-09-19-13/+13
| | | | | | | | | Co-Authored-By: Sebastiaan Zeeff <[email protected]>
| * | Replace incorrect None returns with Optional in certain commandsGravatar sco12019-09-19-17/+24
| | |
| * | Use Optional typing shorthand rather than Union w/NoneGravatar sco12019-09-19-6/+6
| | |
| * | Update paginator defs for correct Optional returnGravatar sco12019-09-19-9/+13
| | | | | | | | | | | | Co-Authored-By: Sebastiaan Zeeff <[email protected]>
| * | Apply suggestions from code review Gravatar S. Co12019-09-19-6/+6
| | | | | | | | | | | | | | | Fix decorator return hints Co-Authored-By: Sebastiaan Zeeff <[email protected]>
| * | Merge branch 'master' into flake8-pluginsGravatar sco12019-09-18-5/+55
| |\ \
| * \ \ Merge branch 'master' into flake8-pluginsGravatar sco12019-09-18-807/+1763
| |\ \ \
| * | | | Docstring linting chunk 7Gravatar sco12019-09-10-155/+96
| | | | | | | | | | | | | | | | | | | | Whew
| * | | | Docstring linting chunk 6Gravatar sco12019-09-10-357/+187
| | | | |
| * | | | Docstring linting chunk 5Gravatar sco12019-09-10-93/+68
| | | | |
| * | | | Docstring linting chunk 4Gravatar sco12019-09-10-176/+125
| | | | |
| * | | | Docstring linting chunk 3Gravatar sco12019-09-10-313/+170
| | | | |
| * | | | Docstring linting chunk 2Gravatar sco12019-09-10-285/+150
| | | | |
| * | | | Docstring linting chunk 1Gravatar sco12019-09-09-141/+114
| | | | |
| * | | | Update linting dependencies & rulesGravatar sco12019-09-09-11/+54
| | | | | | | | | | | | | | | | | | | | | | | | | * Add flake8-annotations * Add flake8-docstrings
| | | | * Return the message to sendGravatar Joseph Banks2019-09-22-0/+2
| | | | |
| | | | * Merge branch 'master' into defcon-fix-djangoGravatar sco12019-09-22-806/+1828
| | | | |\ | |_|_|_|/ |/| | | |
* | | | | Fix date formatting bug in infraction searchGravatar Sebastiaan Zeeff2019-09-19-2/+2
| |_|/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | The infraction search feature did not work because of a small bug with the date formatting: `datetime.fromisoformat` does not like the Z at the end of the datestring the database sends back, so we need to chop it off. I've applied the same method for doing that as already in use in other parts of the bot codebase.
* | | | Add tests for `bot.rules.attachments`. (#426)Gravatar scragly2019-09-19-2/+54
|\ \ \ \ | | | | | | | | | | Add tests for `bot.rules.attachments`.
| * | | | Add tests for `bot.rules.attachments`.Gravatar Johannes Christ2019-09-18-2/+54
|/ / / / | | | | | | | | | | | | This also fixes an issue with the `attachments` rule not respecting the most recent message sent by a user.
* | | | Merge pull request #438 from python-discord/hemlock-infraction-date-humanizationGravatar Mark2019-09-18-2/+7
|\ \ \ \ | | | | | | | | | | Infraction Search Dates
| * | | | Infraction Date HumanizationGravatar Daniel Brown2019-09-18-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Corrected an error that would have made the code bug out. Moved a closing parentheses to the correct spot. Signed-off-by: Daniel Brown <[email protected]>
| * | | | Merge branch 'master' into hemlock-infraction-date-humanizationGravatar Daniel Brown2019-09-18-0/+195
| |\ \ \ \ | |/ / / / |/| | | |
* | | | | Merge pull request #431 from python-discord/bot-cogs-information-testsGravatar Johannes Christ2019-09-18-0/+195
|\ \ \ \ \ | | | | | | | | | | | | Add basic tests for `bot.cogs.information`.
| * | | | | Add basic tests for `bot.cogs.information`.Gravatar Johannes Christ2019-09-18-0/+195
|/ / / / /
| * | | | Infraction Date HumanizationGravatar Daniel Brown2019-09-18-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Changed the if statement to use `is None` for code clarity. Signed-off-by: Daniel Brown <[email protected]>
| * | | | Merge branches 'hemlock-infraction-date-humanization' and 'master' of ↵Gravatar Daniel Brown2019-09-18-8/+10
| |\ \ \ \ | |/ / / / |/| | | | | | | | | https://github.com/python-discord/bot into hemlock-infraction-date-humanization
* | | | | Merge pull request #437 from python-discord/codeblock-suggestion-escape-markdownGravatar Sebastiaan Zeeff2019-09-18-8/+10
|\ \ \ \ \ | |_|_|/ / |/| | | | Escape markdown in codeblock suggestion embed
| * | | | Merge branch 'master' into codeblock-suggestion-escape-markdownGravatar Sebastiaan Zeeff2019-09-18-4/+5
| |\ \ \ \ | |/ / / / |/| | | |
| * | | | Escape markdown in codeblock suggestion embedGravatar Sebastiaan Zeeff2019-09-18-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://github.com/python-discord/bot/issues/434 If the content we prepare for the codeblock suggestion embed defined in the `bot` cog contains markdown characters (e.g., `__`, `**`), this will cause Discord to apply markdown, since both the codeblock syntax example as well as the codeblock result example will contain the characters, making it a matched formatting pair. This will hide those characters, which often have a function in the code, and break the example of a formatted codeblock. To deal with that, I've added a regex substitution that substitutes markdown characters by an escaped version of that markdown character. Example: `'__hello__'` will become `'\_\_hello\_\_'` I've added this substitution to both paths in the `on_message` event listener, since we can't substitute at an earlier place due to it generating `SyntaxErrors` with the `ast.parse` check. This closes #434
| | * | | Infraction Date HumanizationGravatar Daniel Brown2019-09-18-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Changed to use the format `"%Y-%m-%d %H:%M"`, which will turn out looking like `2019-09-18 13:59` Signed-off-by: Daniel Brown <[email protected]>
| | * | | Infraction Date HumanizationGravatar Daniel Brown2019-09-18-2/+7
| |/ / / |/| | | | | | | | | | | | | | | | | | | - Changed the date returned on infraction searches to use the `"%c"` strftime format instead of the standard ISO format. Signed-off-by: Daniel Brown <[email protected]>
* | | | Merge pull request #436 from python-discord/enhance-offtopicnames-searchGravatar Kieran Siek2019-09-18-4/+5
|\ \ \ \ | |/ / / |/| | | Enhance off-topic names search feature
| * | | Enhance off-topic names search featureGravatar Sebastiaan Zeeff2019-09-17-4/+5
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://github.com/python-discord/bot/issues/435 This commit is meant to enhance the search feature in three separate, but related ways: 1. By changing the type annotation of the query to OffTopicName, we will use the same character translation table for the query as we did when storing the off-topic name, leading to better matches. 2. By adding a membership test, `query in name`, we are better able to search for off-topic names using a substring. 3. Given point 1 and point 2, we can increase the cut-off value we use for `difflib.get_close_matches` so we reduce the number of matches that bear little resemblance to the query in our human eyes. This commit closes #435
* | | Add basic tests for `bot.api`. (#424)Gravatar scragly2019-09-18-1/+126
|\ \ \ | | | | | | | | Add basic tests for `bot.api`.
| * | | Recombine import groups.Gravatar scragly2019-09-18-1/+0
| | | |
| * | | Add basic tests for `bot.api`.Gravatar Johannes Christ2019-09-18-1/+127
|/ / /
* | | Validate configuration against typehints, remove old keys, renam… (#425)Gravatar scragly2019-09-18-13/+25
|\ \ \ | | | | | | | | Validate configuration against typehints, remove old keys, rename off_topic_3 key