aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeLines
...
| * | | | | | | | | | | Relay attchments to #attachment_logGravatar Akarys422019-12-14-1/+2
| | | | | | | | | | | |
| * | | | | | | | | | | Merge branch 'master' into #549-show-attachments-staffGravatar Matteo Bertucci2019-12-12-334/+1348
| |\ \ \ \ \ \ \ \ \ \ \ | | | |_|_|_|_|_|_|/ / / | | |/| | | | | | | | |
| * | | | | | | | | | | AntiSpam: remove bot field from DeletionContextGravatar MarkKoz2019-12-03-14/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The destination channel can be retrieved be accessing a message's guild. * Remove unused queue_consumption_tasks attribute.
| * | | | | | | | | | | ModLog: fix 0 message logs uploaded when no attachments givenGravatar MarkKoz2019-12-03-8/+3
| | | | | | | | | | | |
| * | | | | | | | | | | AntiSpam: correct a function annotationGravatar MarkKoz2019-12-03-3/+3
| | | | | | | | | | | |
| * | | | | | | | | | | AntiSpam: replace reupload_attachments with send_attachments from utilsGravatar MarkKoz2019-12-03-28/+6
| | | | | | | | | | | |
| * | | | | | | | | | | Utils: have send_attachments save attachments using the cached URLGravatar MarkKoz2019-12-03-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes it more likely to successfully save an attachment after it's been deleted.
| * | | | | | | | | | | Utils: log send_attachments failures instead of raising exceptionsGravatar MarkKoz2019-12-03-1/+10
| | | | | | | | | | | |
| * | | | | | | | | | | Utils: add send_attachments param to disable linking to too-large filesGravatar MarkKoz2019-12-03-7/+14
| | | | | | | | | | | |
| * | | | | | | | | | | Utils: use the guild's filesize_limit to determine max attachment sizeGravatar MarkKoz2019-12-03-4/+3
| | | | | | | | | | | |
| * | | | | | | | | | | Utils: support returning URLs from send_attachmentsGravatar MarkKoz2019-12-03-4/+8
| | | | | | | | | | | |
| * | | | | | | | | | | ModLog: use more generic type annotationsGravatar MarkKoz2019-12-03-4/+4
| | | | | | | | | | | |
| * | | | | | | | | | | Merge branch 'master' into #549-show-attachments-staffGravatar Matteo Bertucci2019-11-29-1055/+2005
| |\ \ \ \ \ \ \ \ \ \ \ | | | |_|_|_|_|_|_|_|_|/ | | |/| | | | | | | | |
| * | | | | | | | | | | Re-upload attachments to #attachment-logGravatar Matteo Bertucci2019-11-28-1/+1
| | | | | | | | | | | |
| * | | | | | | | | | | Update try/except block in reupload_attachments()Gravatar Matteo Bertucci2019-11-28-2/+5
| | | | | | | | | | | |
| * | | | | | | | | | | Fix misspellingGravatar Matteo Bertucci2019-11-28-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-Authored-By: Mark <[email protected]>
| * | | | | | | | | | | Add try/except for attachment savingGravatar Akarys422019-11-27-5/+8
| | | | | | | | | | | |
| * | | | | | | | | | | Move attachments re-uploading to DeletionContext.add()Gravatar Akarys422019-11-27-24/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So they are re-uploaded before being deleted
| * | | | | | | | | | | Re-indent argumentsGravatar Matteo Bertucci2019-11-19-3/+3
| | | | | | | | | | | |
| * | | | | | | | | | | Use a context manager for the bufferGravatar Matteo Bertucci2019-11-15-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: Shirayuki Nekomata <[email protected]>
| * | | | | | | | | | | Re-post attachmentsGravatar Matteo Bertucci2019-10-31-5/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before sending the attachments to API for logging, we now re-post them in the channel that have the id stored in the constant Guild.attachment_repost (it needs to be configured). These new links will never expires.
| | | | * | | | | | | | Merge branch 'master' into remove-prometheusGravatar Joseph2020-02-02-1/+1
| | | | |\ \ \ \ \ \ \ \ | |_|_|_|/ / / / / / / / |/| | | | | | | | | | |
| | | | * | | | | | | | Remove prometheus related codeGravatar Joseph Banks2020-02-02-272/+128
| | | | | | | | | | | |
| | | | | * | | | | | | Made searching even stricter by searching from start of each wordGravatar Shirayuki Nekomata2020-02-05-11/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Added regex back to sub and split by non-alphabet. - Now use two pointers to move from words to words.
| | | | | * | | | | | | Removed regex, implemented a stricter letter searching.Gravatar Shirayuki Nekomata2020-02-05-10/+12
| | | | | | | | | | | |
| | | | | * | | | | | | Increased default thresholds from just [100, 80] to [100, 90, 80, 70, 60]Gravatar Shirayuki Nekomata2020-02-05-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Since it is returning as soon as there are suggestions found for a threshold, this will give a better reflection of what the bot thinks user is searching for.
| | | | | * | | | | | | Removed non-alphabets from both search and tag_name when scoring.Gravatar Shirayuki Nekomata2020-02-05-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Added a regex to remove non-alphabet ( `[^a-z]` with `re.IGNORECASE` )
| | | | | * | | | | | | Refactored _get_suggestions following Mark's suggestions about inefficiency.Gravatar Shirayuki Nekomata2020-02-04-12/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Matching scores will be calculated once now and stored in the dict `scores`. - Allow `_get_suggestions()` to go through a list of score threshold and return the first list of matching tags that's not empty and above the threshold. This avoid calling the function multiple time like before ( `self._get_suggestions(tag_name, 100) or self._get_suggestions(tag_name, 80)` for example, is calling this function twice, and is inefficient ) - Deleted commented line. - Added `typing` module for more typehints.
| | | | | * | | | | | | Fixed _last_fetch not being updated after each api call.Gravatar Shirayuki Nekomata2020-02-04-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Changed type of `self._last_fetch` to `float` and give it the initial value of `0.0` instead of `None` - Assigned `time.time()` to `time_now` to avoid calling this function twice. - Added `self._last_fetch = time_now` after calling the api call.
| | | | | * | | | | | | Merge branch 'master' into fuzzy-tag-searchGravatar Joseph2020-02-02-2959/+6887
| | | | | |\ \ \ \ \ \ \ | |_|_|_|_|/ / / / / / / |/| | | | | | | | | | |
| | | | | * | | | | | | 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
| | | | | | | | | | | |
| | | | | | | * | | | | Add unit test for newlines antispam ruleGravatar kwzrd2020-02-04-0/+105
| | | | | | | | | | | |
| | | | | | | * | | | | Add unit test for duplicates antispam ruleGravatar kwzrd2020-02-04-0/+66
| | | | | | | | | | | |
| | | | | | | * | | | | Merge branch 'master' into unittest-antispam-rulesGravatar Joseph2020-02-02-1/+10
| | | | | | | |\ \ \ \ \ | |_|_|_|_|_|_|/ / / / / |/| | | | | | | | | | |
* | | | | | | | | | | | Update CODEOWNERSGravatar Joseph2020-02-02-1/+1
| |_|_|/ / / / / / / / |/| | | | | | | | | |
* | | | | | | | | | | Merge pull request #736 from python-discord/tagptroll1-md-filefilterGravatar kwzrd2020-02-02-0/+1
|\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Update config-default.yml - Allow .md files
| * | | | | | | | | | | Update config-default.ymlGravatar Thomas Petersson2020-02-02-0/+1
|/ / / / / / / / / / /
* | | | | | | | | | | Create CODEOWNERSGravatar Joseph2020-02-02-0/+1
| | | | | | | | | | |
* | | | | | | | | | | 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 RuleTest use ABCMetaGravatar kwzrd2020-02-02-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This will prevent child classes to be instantiated unless they implement all abstract methods, leading to a more descriptive error message.
| | | | | | * | | | Adjust existing tests to inherit from RuleTest ABCGravatar kwzrd2020-02-02-294/+157
| | | | | | | | | |