aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeLines
...
| * | | | | | | Merge pull request #735 from python-discord/test-resourcesGravatar Leon Sandøy2020-01-30-1/+8
| |\ \ \ \ \ \ \ | | |_|_|_|_|_|/ | |/| | | | | | Add additional resources to the test readme
| | * | | | | | Merge the note with the additional resources sectionGravatar Matteo Bertucci2020-01-30-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | Move the link to Ned Batchelder’s talk and link the note to the section
| | * | | | | | Add additional resources to the test readmeGravatar Matteo Bertucci2020-01-30-0/+6
| |/ / / / / /
| | | | | * | 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
| | | | | | |
* | | | | | | Use kwargs to set mock attributesGravatar Matteo2020-02-18-25/+11
| | | | | | |
* | | | | | | Assert return value of Snekbox.post_evalGravatar Matteo2020-02-18-1/+3
| | | | | | |
* | | | | | | Use a space instead of an empty string in test_get_status_emoji Gravatar Matteo Bertucci2020-02-18-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because of the stripping, it should still be considered as empty Co-Authored-By: Mark <[email protected]>
* | | | | | | Delete additional informations from subtest Gravatar Matteo Bertucci2020-02-18-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reduce visual clutter Co-Authored-By: Mark <[email protected]>
* | | | | | | Split assertions onto separate lines Gravatar Matteo Bertucci2020-02-18-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reads better as separate lines Co-Authored-By: Mark <[email protected]>
* | | | | | | Split assertion onto separate linesGravatar Matteo Bertucci2020-02-18-1/+2
| | | | | | | | | | | | | | | | | | | | | Co-Authored-By: Mark <[email protected]>
* | | | | | | Snekbox small refactoringGravatar Matteo2020-02-18-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Makes the code a bit clearer Co-authored-by: Shirayuki Nekomata <[email protected]>
* | | | | | | Suppress HTTPException while deleting bot outputGravatar Matteo2020-02-18-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It was triggering an error if the user deleted the output before re-evaluating
* | | | | | | Use pregenerated partialsGravatar Matteo2020-02-18-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This avoid recreating partials for each re-eval
* | | | | | | Write tests for bot/cogs/test_snekbox.pyGravatar Akarys422020-02-09-0/+363
| | | | | | |
* | | | | | | Create an AsyncContextManagerMock mock for testing asynchronous context managersGravatar Akarys422020-02-09-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It can be used to test aiohttp request functions, since they are async context managers
* | | | | | | Use actual functions instead of lambdas for bot.wait_forGravatar Akarys422020-02-09-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The use of lambdas made the functions hard to test, this new format allows us to easily test those functions and document them.
* | | | | | | Merge branch 'master' into eval-enhancementsGravatar Matteo Bertucci2020-01-30-350/+648
|\| | | | | |
| * | | | | | Merge pull request #730 from python-discord/user-info-fixGravatar Mark2020-01-16-1/+5
| |\ \ \ \ \ \ | | | | | | | | | | | | | | | | Fix user command error for empty custom status
| | * \ \ \ \ \ Merge branch 'master' into user-info-fixGravatar Mark2020-01-16-122/+272
| | |\ \ \ \ \ \ | | |/ / / / / / | |/| | | | | |
| * | | | | | | Merge pull request #701 from manusaurio/fetched-userGravatar Shirayuki Nekomata2020-01-16-114/+171
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Support applying infractions to users not in the DB via Converter `FetchedUser`
| | * \ \ \ \ \ \ Merge branch 'master' into fetched-userGravatar manusaurio2020-01-16-284/+658
| | |\ \ \ \ \ \ \ | | |/ / / / / / / | |/| | | | | | |
| * | | | | | | | Merge pull request #686 from python-discord/feature/645-voice-event-logGravatar Shirayuki Nekomata2020-01-16-8/+101
| |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | Log voice channel events
| | * \ \ \ \ \ \ \ Merge branch 'master' into feature/645-voice-event-logGravatar Shirayuki Nekomata2020-01-16-577/+1298
| | |\ \ \ \ \ \ \ \ | | |/ / / / / / / / | |/| | | | | | | |
| | * | | | | | | | ModLog: support self_stream voice stateGravatar MarkKoz2019-12-18-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This feature will be available in discord.py 1.3.
| | * | | | | | | | ModLog: change voice state embed icon and colourGravatar MarkKoz2019-12-18-5/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use a red icon when leaving or mute/deafened. Use a green icon when joining or unmuted/undeafened. Use a blue icon when changing channels or any other possible change.
| | * | | | | | | | Constants: add voice state emotesGravatar MarkKoz2019-12-18-0/+8
| | | | | | | | | |
| | * | | | | | | | ModLog: exclude afk attribute from voice state logGravatar MarkKoz2019-12-11-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The log will already show that the channel changes to the AFK channel so showing the attribute change is redundant. If the channel were not clearly named "AFK" then it might've made sense to keep the attribute.
| | * | | | | | | | ModLog: exclude most channel attributes from voice state diffGravatar MarkKoz2019-12-11-2/+8
| | | | | | | | | |
| | * | | | | | | | ModLog: make voice state event respect ignored channelsGravatar MarkKoz2019-12-11-1/+4
| | | | | | | | | |
| | * | | | | | | | ModLog: use Unicode arrow when displaying value changesGravatar MarkKoz2019-12-11-8/+8
| | | | | | | | | |
| | * | | | | | | | ModLog: log voice state updatesGravatar MarkKoz2019-12-11-0/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add corresponding event to the Event enum so the event can be ignored
| | * | | | | | | | Add constants for voice state loggingGravatar MarkKoz2019-12-10-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add ID for the voice-log channel. * Add IDs for admins & staff voice channels and make the mod log ignore them.
| | | * | | | | | | Move Expiry converter alias to converters.pyGravatar MarkKoz2019-12-23-10/+10
| | | | | | | | | |
| | | * | | | | | | Refactor user type aliasesGravatar MarkKoz2019-12-23-15/+15
| | | | | | | | | |
| | | * | | | | | | Create an alias for a Member + FetchedUser converterGravatar MarkKoz2019-12-23-20/+23
| | | | | | | | | |
| | | * | | | | | | Make FetchedUser a subclass of UserConverterGravatar MarkKoz2019-12-22-50/+52
| | | | | | | | | |
| | | * | | | | | | Use log.warning instead of the deprecated log.warnGravatar MarkKoz2019-12-22-1/+1
| | | | | | | | | |
| | | * | | | | | | Merge branch 'master' into fetched-userGravatar manusaurio2019-12-22-1/+18
| | | |\ \ \ \ \ \ \
| | | * | | | | | | | Show only status code in Discord msg when infraction post failsGravatar MarkKoz2019-12-22-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When debugging, the response_text exceeds the character limit since it's basically an entire HTML document.
| | | * | | | | | | | Use more specific error message for infraction DM user fetchGravatar MarkKoz2019-12-22-1/+1
| | | | | | | | | | |
| | | * | | | | | | | Remove unreachable break in post_infraction loopGravatar MarkKoz2019-12-22-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Show the user in the post_infraction error log message
| | | * | | | | | | | Catch HTTPException in fetching, only fetch if isn't User or MemberGravatar Manuel Ignacio Pérez Alcolea2019-12-22-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's now a check to see if the `user` argument (possibly a `discord.Object`) needs to be made a `User`, instead of doing so directly, to avoid unnecessary requests to the Discord API. Besides that, a possible HTTPException is catched if it the fetch fails, cancelling the message to be send to the user (which would make the following calls fail later on for not being of the proper type.)
| | | * | | | | | | | Make `watchchannels` use `FetchedUser` instead of `proxy_user`Gravatar Manuel Ignacio Pérez Alcolea2019-12-22-31/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes also removes the original `proxy_user` used by `watchchannels` the attributes in its `discord.Object` object to the one returned by FetchedUser.