aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeLines
...
| | | | | | | | | | * | | | | | Adjust links rule to use proper MockMessageGravatar kwzrd2019-11-13-14/+10
| | | | | | | | | | | | | | | |
| | | | | | | | | | * | | | | | Merge branch 'master' into unittest-mentionsGravatar kwzrd2019-11-13-179/+187
| | | | | | | | | | |\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Testing methodology was adjusted in upstream repo. Merging the relevant changes.
| | | | | | | | | | * | | | | | | Adjust incorrect type hintGravatar kwzrd2019-11-09-1/+1
| | | | | | | | | | | | | | | | |
| | | | | | | | | | * | | | | | | Use MockMessage instead of custom FakeMessageGravatar kwzrd2019-11-09-15/+11
| | | | | | | | | | | | | | | | |
| | | | | | | | | | * | | | | | | Adjust type hint to correctly represent internal typeGravatar kwzrd2019-11-09-1/+1
| | | | | | | | | | | | | | | | |
| | | | | | | | | | * | | | | | | Use range to build mock mentions listGravatar kwzrd2019-11-09-1/+1
| | | | | | | | | | | | | | | | |
| | | | | | | | | | * | | | | | | Adjust docstring asterisk to backtick for consistencyGravatar kwzrd2019-11-09-1/+1
| | | | | | | | | | | | | | | | |
| | | | | | | | | | * | | | | | | Add missing docstringGravatar kwzrd2019-11-09-0/+1
| | | | | | | | | | | | | | | | |
| | | | | | | | | | * | | | | | | Add unit test for mentions antispam ruleGravatar kwzrd2019-11-09-0/+98
| | | | | | | | | | | | | | | | |
| | | | | | | | | | | | * | | | | Whitelist Discord Testers invite linkGravatar Matteo Bertucci2019-12-10-0/+1
| | | | |_|_|_|_|_|_|_|/ / / / / | | | |/| | | | | | | | | | | |
| | | | | | | | | | | | | * | | Make it easier for user to search for tagsGravatar Shirayuki Nekomata2019-10-18-9/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | #### Closes #231 Applying the algorithm for `Needles and Haystack` to find and match tag in tags, for example: ![Example](https://cdn.discordapp.com/attachments/634243438459486219/634592981915140107/unknown.png) This only applies to searching tag_name with more than 3 in length, and at least 80% of its letters are found, from left to right. There are 3 levels of checking, stop at first found: - Check if exact name ( case insensitive ) O(1) getting from a dictionary Dict[str, Tag] - Check for all tags that has 100% matching via algorithm - Check for all tags that has >= 80% matching If there are more than one hit, it will be shown as suggestions: ![Suggestions](https://cdn.discordapp.com/attachments/634243438459486219/634595369531211778/unknown.png) In order to avoid api being called multiple times, I've implemented a cache to only refresh itself when the is a gap of more than 5 minutes from the last api call to get all tags. Editing / Adding / Deleting tags will also modify the cache directly. ##### What about other solution like fuzzywuzzy? fuzzywuzzy was considered for using, but from testing, it was giving much lower scores than expected: Code used to test: ```py from fuzzywuzzy import fuzz def _fuzzy_search(search: str, target: str) -> bool: found = 0 index = 0 _search = search.lower().replace(' ', '') _target = target.lower().replace(' ', '') for letter in _search: index = _target.find(letter, index) if index == -1: break found += index > 0 # return found / len(_search) * 100 return ( found / len(_search) * 100, fuzz.ratio(search, target), fuzz.partial_ratio(search, target) ) tests = ( 'this-is-gonna-be-fun', 'this-too-will-be-fun' ) for test in tests: print(test, '->', _fuzzy_search('this too fun', test)) ``` Result from test: ```py this-is-gonna-be-fun -> (30.0, 50, 50) this-too-will-be-fun -> (90.0, 62, 58) ```
| | | | | | | | | | | | | | * | Fix linting errorGravatar kosayoda2019-10-28-2/+2
| | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | * | Apply suggestions from code review Gravatar Kieran Siek2019-10-28-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix incorrect docstring and comment Co-Authored-By: Mark <[email protected]>
| | | | | | | | | | | | | | * | Add delete emoji to paginationGravatar kosayoda2019-10-28-10/+21
| | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | * | Revert "Remove dev-test limit for filtering debugging"Gravatar kosayoda2019-10-28-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 56696b3b1858ad27dc7f3dce2898c7a6eb151f43.
| | | | | | | | | | | | | | * | Remove dev-test limit for filtering debuggingGravatar kosayoda2019-10-27-2/+2
| | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | * | Differentiate clear and delete emoji in help cogGravatar kosayoda2019-10-27-10/+13
| | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | * | Use trashcan emoji for message deletionGravatar kosayoda2019-10-27-1/+9
| | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | * Merge remote-tracking branch 'origin/master' into zen-commandGravatar MarkKoz2019-12-12-1209/+3144
| | | | | | | | | | | | | | | |\ | |_|_|_|_|_|_|_|_|_|_|_|_|_|_|/ |/| | | | | | | | | | | | | | |
* | | | | | | | | | | | | | | | Subclass Bot (#681)Gravatar scragly2019-12-12-185/+225
|\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Subclass Bot
| * | | | | | | | | | | | | | | | Use the AsyncResolver for APIClient and discord.py sessions tooGravatar MarkKoz2019-12-08-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Active thread counts are observed to be lower with it in use.
| * | | | | | | | | | | | | | | | Fix test failures for setup log messagesGravatar MarkKoz2019-12-08-24/+7
| | | | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | | | Properly create and close aiohttp sessionsGravatar MarkKoz2019-12-08-10/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | aiohttp throws a warning when a session is created outside of a running async event loop. In aiohttp 4.0 this actually changes to an error instead of merely a warning. Since discord.py manages the event loop with client.run(), some of the "internal" coroutines of the client were overwritten in the bot subclass to be able to hook into when the bot starts and stops. Sessions of both the bot and the API client can now potentially be None if accessed before the sessions have been created. However, if called, the API client's methods will wait for a session to be ready. It will attempt to create a session as soon as the event loop starts (i.e. the bot is running).
| * | | | | | | | | | | | | | | | Fix name conflict with the Bot cogGravatar MarkKoz2019-12-08-3/+3
| | | | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | | | Override add_cog to log loading of cogsGravatar MarkKoz2019-12-08-80/+34
| | | | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | | | Change all Bot imports to use the subclassGravatar MarkKoz2019-12-07-52/+92
| | | | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | | | Subclass BotGravatar MarkKoz2019-12-07-24/+32
| | |_|_|_|_|_|_|_|/ / / / / / / | |/| | | | | | | | | | | | | |
* | | | | | | | | | | | | | | | Merge pull request #684 from python-discord/enhancement/644-mute-kicks-voiceGravatar Mark2019-12-12-6/+15
|\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Kick users from voice when they get muted
| * \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Merge branch 'master' into enhancement/644-mute-kicks-voiceGravatar Matteo Bertucci2019-12-12-0/+10
| |\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ | |/ / / / / / / / / / / / / / / / |/| | | | | | | | | | | | | | | |
* | | | | | | | | | | | | | | | | Fix tag fallback not respecting checks (#687)Gravatar scragly2019-12-12-0/+10
|\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ | |_|_|_|_|/ / / / / / / / / / / / |/| | | | | | | | | | | | | | | | Fix tag fallback not respecting checks
| * | | | | | | | | | | | | | | | ErrorHandler: fix #650 tag fallback not respecting checksGravatar MarkKoz2019-12-11-0/+10
|/ / / / / / / / / / / / / / / /
| * | | | | | | | | | | | | | | Infractions: kick user from voice after muting (#644)Gravatar MarkKoz2019-12-09-2/+7
| | | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | | Moderation: catch HTTPException when applying an infractionGravatar MarkKoz2019-12-09-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only a warning is logged if it's a Forbidden error. Otherwise, the whole exception is logged.
| * | | | | | | | | | | | | | | Moderation: show HTTP status code in the log for deactivation failuresGravatar MarkKoz2019-12-09-1/+1
|/ / / / / / / / / / / / / / /
* | | | | | | | | | | | | | | Merge pull request #682 from manusaurio/masterGravatar Shirayuki Nekomata2019-12-09-0/+3
|\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ | |/ / / / / / / / / / / / / / |/| | | | | | | | | | | | | | Ensure hidden_channels and bypass_roles use a list when not passed.
| * | | | | | | | | | | | | | Ensure hidden_channels and bypass_roles use a list when not passed.Gravatar Manuel Ignacio Pérez Alcolea2019-12-09-0/+3
|/ / / / / / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The in_channel decorator raised 'NoneType' is not iterable when it wasn't passed, due to the default value being None but not checked against before iterating over it. This edit ensures the arguments are set to an empty list in cases where they have a value of None instead.
* | | / / / / / / / / / / / Added optional channel parameter to !echo:Gravatar Daniel Brown2019-12-05-4/+7
| |_|/ / / / / / / / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Added the option to specify a channel to have Python repeat what you said to it, as well as keeping the old functionality of having it repeat what you said in the current channel if no channel argument is given. Signed-off-by: Daniel Brown <[email protected]>
* | | | | | | | | | | | | Merge pull request #678 from python-discord/antimalware-paste-urlGravatar Mark2019-12-03-1/+1
|\ \ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Antimalware: fix paste service URL showing replacement field
| * | | | | | | | | | | | | Antimalware: fix paste service URL showing replacement fieldGravatar MarkKoz2019-12-03-1/+1
| | | | | | | | | | | | | |
* | | | | | | | | | | | | | Merge pull request #672 from ↵Gravatar Mark2019-12-03-6/+28
|\ \ \ \ \ \ \ \ \ \ \ \ \ \ | |/ / / / / / / / / / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | python-discord/enhance-timedelta-for-infraction-expiration Enhance timedelta for infraction expiration
| * | | | | | | | | | | | | Renamed function and improved its docstring to better reflect its purposes.Gravatar Shirayuki Nekomata2019-12-04-16/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changed from `get_duration_from_expiry` -> `format_infraction_with_duration`
| * | | | | | | | | | | | | Deleted `get_duration` and switched to using the already, nicely made ↵Gravatar Shirayuki Nekomata2019-12-03-48/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `humanize_delta`
| * | | | | | | | | | | | | Removed pytest, getting ready to migrate to unittest in another PRGravatar Shirayuki Nekomata2019-12-03-44/+0
| | | | | | | | | | | | | |
| * | | | | | | | | | | | | Updated test cases for `parts: Optional[int]`Gravatar Shirayuki Nekomata2019-11-27-23/+32
| | | | | | | | | | | | | |
| * | | | | | | | | | | | | Updated docstrings, allow passing `parts: Optional[int] = 2` to helper ↵Gravatar Shirayuki Nekomata2019-11-27-6/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | functions to return more than just 2 parts of the duration.
| * | | | | | | | | | | | | Updated test cases for `get_duration_from_expiry()`Gravatar Shirayuki Nekomata2019-11-27-8/+9
| | | | | | | | | | | | | |
| * | | | | | | | | | | | | Refactored `scheduler.py` to use the new `get_duration_from_expiry()`Gravatar Shirayuki Nekomata2019-11-27-10/+4
| | | | | | | | | | | | | |
| * | | | | | | | | | | | | Refactored `management.py` to use the new `get_duration_from_expiry()`Gravatar Shirayuki Nekomata2019-11-27-5/+4
| | | | | | | | | | | | | |
| * | | | | | | | | | | | | Changed `get_duration_from_expiry()` to return the `time (duration)` or a `''`Gravatar Shirayuki Nekomata2019-11-27-2/+11
| | | | | | | | | | | | | |
| * | | | | | | | | | | | | Added duration until expiration for infraction searching.Gravatar Shirayuki Nekomata2019-11-27-2/+5
| | | | | | | | | | | | | |