aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeLines
...
| * | | | | | | | | | AntiSpam: create tasks in a safer mannerGravatar MarkKoz2021-04-09-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Name the tasks and use `scheduling.create_task` to ensure exceptions are caught.
| * | | | | | | | | | AntiSpam: prevent attempts to punish a user multiple timesGravatar MarkKoz2021-04-09-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A user may manage to send multiple message that violate filters before the mute is applied. Because of a race condition, subsequent punish attempts did not detect the mute role exists and therefore proceeded to apply another mute. To avoid the race condition, abort any subsequent punish attempts while one is already ongoing for a given user. It could be possible to wait instead of abort, but the first attempt failing very likely means subsequent attempts would fail too. Fixes #902
| | * | | | | | | | | Branding: adjust duration string for 1-day eventsGravatar kwzrd2021-04-13-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of: 'January 1 - January 1' Do: 'January 1'
| | * | | | | | | | | Branding: use tz-aware datetime representationGravatar kwzrd2021-04-13-7/+8
| |/ / / / / / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using `datetime.utcnow` produces a tz-naive object. When converting the object into a POSIX timestamp (L212), the library then converts the naive object into UTC, which will offset it unless the local timezone is UTC. We prevent this behaviour by using an Arrow repr instead, which is by default tz-aware. Since the object already knows it is in UTC, it does not shift when converting to a timestamp. Because L233 used `fromtimestamp` rather than `utcfromtimestamp`, the timestamp then got converted back into local time, canceling the previous error. Therefore, the bug wasn't observable from logs, as the times looked correct, but were being stored incorrectly. By using `Arrow.utcfromtimestamp`, the created object will be aware of being UTC again, which is more safe.
* | | | | | | | | | Merge pull request #1521 from ToxicKidz/dont-use-startswithGravatar ChrisJL2021-04-12-2/+3
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Use == instead of str.startswith when getting the source for a Command
| * \ \ \ \ \ \ \ \ \ Merge branch 'main' into dont-use-startswithGravatar ChrisJL2021-04-12-792/+1629
| |\ \ \ \ \ \ \ \ \ \ | |/ / / / / / / / / / |/| | | | | | | | | |
* | | | | | | | | | | Remove reactions from everyone when paginating and waiting for trashcan ↵Gravatar ToxicKidz2021-04-12-44/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | reaction. (#1471) * Remove reactions from everyone * Make flake8 happy * Make flake8 happy again * Remove reactions in check functions * Make flake8 happy for the last time * Update bot/pagination.py Co-authored-by: Kieran Siek <[email protected]> * Make create_task one line and return False in checks * Fix return so it returns either True or False * Use scheduling.create_task and suppress HTTPException * Suppress HTTPException in scheduling.create_task * Remove double if-statements Co-authored-by: Mark <[email protected]> * change suppress_exceptions to suppressed_exceptions * Make suppressed_exceptions a kwargs for _log_task_exception * Update scheduling.create_task call to correspond with *args * Fix NameError: reaction, user -> reaction_, user_ * Update scheduling.create_task call to correspond with *args in messages.wait_for_deletion * reaction -> reaction_ * Ignore reactions from the bot * Fix type annotations for create_task * Refactor add_reaction check to a separate function * Name the remove_reaction task Co-authored-by: Kieran Siek <[email protected]> Co-authored-by: Mark <[email protected]>
* | | | | | | | | | | Merge pull request #1014 from Numerlor/doc-impGravatar Joe Banks2021-04-12-748/+1561
|\ \ \ \ \ \ \ \ \ \ \
| * \ \ \ \ \ \ \ \ \ \ Merge branch 'main' into doc-impGravatar kosayoda2021-04-12-1190/+1562
| |\ \ \ \ \ \ \ \ \ \ \ | |/ / / / / / / / / / / |/| | | | | | | | | | |
| * | | | | | | | | | | update commentGravatar Numerlor2021-04-08-1/+1
| | | | | | | | | | | |
| * | | | | | | | | | | Use 'Similar names' instead of 'moved' in footerGravatar Numerlor2021-04-08-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The meaning of 'moved' may not have been clear for people that weren't familiar with how the system works Co-authored-by: MarkKoz <[email protected]>
| * | | | | | | | | | | Add missing 'attempts'Gravatar Numerlor2021-04-01-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: Kieran Siek <[email protected]>
| * | | | | | | | | | | Ensure the base url ends with a slashGravatar Numerlor2021-03-26-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A base url without a trailing slash won't join properly with the relative paths, raising an error my prevent some mistakes when a new inventory is added
| * | | | | | | | | | | Merge remote-tracking branch 'upstream/main' into doc-impGravatar Numerlor2021-03-25-1137/+2118
| |\ \ \ \ \ \ \ \ \ \ \
| * | | | | | | | | | | | swap single quotes to double quotes where they were unnecessaryGravatar Numerlor2021-03-25-20/+20
| | | | | | | | | | | | |
| * | | | | | | | | | | | Replace shorten with custom algo to find good cutoff pointsGravatar Numerlor2021-03-16-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | shorten collapses the whitespace, causing issues with codeblocks
| * | | | | | | | | | | | Update the symbol_name when fetching the DocItem from get_symbol_itemGravatar Numerlor2021-03-16-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Moving the block handling the fetching into a separate method meant that symbol_name was no longer updated inside the create_symbol_embed method, causing the whole message to be included in the embed title in case the space shortcut was used
| * | | | | | | | | | | | Correct length limits to embed limitsGravatar Numerlor2021-03-12-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously the code used limits that apply to raw messages, not embeds. Both the description and footer limits are separate, while their individual limits are 2048 chars instead of 2000. The footer overhead was removed from the max description length and the footer is now truncated to 200 chars which is roughly 2 lines
| * | | | | | | | | | | | Use a clearer approach with less duplicate codeGravatar Numerlor2021-03-10-46/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: MarkKoz <[email protected]>
| * | | | | | | | | | | | Hold the symbol_get_event in the entire body of create_symbol_embedGravatar Numerlor2021-03-10-24/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While the previous code was safe, the synchronization was spread out over different modules and was hard to wrap around. Additionally changes could introduce context switches without the author being aware of them causing potential race conditions with the refresh. Moving the whole body into the with block solves both of these issues
| * | | | | | | | | | | | Handle arbitrary amount of backslashes preceding the quote charGravatar Numerlor2021-03-07-11/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tests for this were added additionally
| * | | | | | | | | | | | Remove superfluous commentGravatar Numerlor2021-03-06-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After the move to a separate method, the docstring now documents the behaviour so a comment is unnecessary
| * | | | | | | | | | | | Handle unexpected errors when requesting markdownGravatar Numerlor2021-03-06-1/+12
| | | | | | | | | | | | |
| * | | | | | | | | | | | Create the footer text before an inventory refresh can occurGravatar Numerlor2021-03-06-5/+6
| | | | | | | | | | | | |
| * | | | | | | | | | | | Abstract logic from create_symbol_embed into additional methodsGravatar Numerlor2021-03-06-18/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The method was also renamed from get_symbol_embed to create_symbol_embed
| * | | | | | | | | | | | Correct tests casesGravatar Numerlor2021-03-05-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The tests were not adjusted after the converter was corrected to accept digits
| * | | | | | | | | | | | Clarify the use of _set_expires and needs_expireGravatar Numerlor2021-03-05-0/+3
| | | | | | | | | | | | |
| * | | | | | | | | | | | Rename markup_hint to MarkupGravatar Numerlor2021-03-05-2/+2
| | | | | | | | | | | | |
| * | | | | | | | | | | | Name tasksGravatar Numerlor2021-03-05-5/+13
| | | | | | | | | | | | |
| * | | | | | | | | | | | Use scheduling's create_taskGravatar Numerlor2021-03-05-1/+1
| | | | | | | | | | | | |
| * | | | | | | | | | | | Add comment explaining purpose of create_task over awaitGravatar Numerlor2021-03-05-0/+1
| | | | | | | | | | | | |
| * | | | | | | | | | | | Set future result to None on exceptionsGravatar Numerlor2021-03-05-7/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can still provide th user with at least the link to the docs, for which we already have handling in the cog with a generic "unable to parse message", using exceptions for that would mean setting it here, immediately catching it and then providing the same or very similar message.
| * | | | | | | | | | | | Correct typehintGravatar Numerlor2021-03-05-2/+2
| | | | | | | | | | | | |
| * | | | | | | | | | | | Move future assignment and check outside of the tryGravatar Numerlor2021-03-05-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | No exceptions can be raised from the two lines of code because of the data structures used, moving it out makes for flatter code.
| * | | | | | | | | | | | Rename params to clearer and more concise alternativesGravatar Numerlor2021-03-05-6/+6
| | | | | | | | | | | | |
| * | | | | | | | | | | | Explain use of various containers in the cogGravatar Numerlor2021-03-05-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: MarkKoz <[email protected]>
| * | | | | | | | | | | | Use placeholder consistent with others in the cogGravatar Numerlor2021-03-05-1/+1
| | | | | | | | | | | | |
| * | | | | | | | | | | | Add comments to the parsing moduleGravatar Numerlor2021-03-05-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: MarkKoz <[email protected]>
| * | | | | | | | | | | | Account for ellipses when determining the truncation description indexGravatar Numerlor2021-03-05-3/+3
| | | | | | | | | | | | |
| * | | | | | | | | | | | Remove placeholder in shorten callGravatar Numerlor2021-03-05-1/+1
| | | | | | | | | | | | |
| * | | | | | | | | | | | Use clearer branchingGravatar Numerlor2021-03-05-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: MarkKoz <[email protected]>
| * | | | | | | | | | | | Add comments for purpose of DocItem attributesGravatar Numerlor2021-03-05-5/+5
| | | | | | | | | | | | |
| * | | | | | | | | | | | Do _item_futures cleanup in _parse_queue instead of a concurrent taskGravatar Numerlor2021-03-05-33/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The doc_cache coro was changed to be awaited directly instead of creating a task to ensure the cache is populated before the item is deleted
| * | | | | | | | | | | | Set the result of the future instead of an exception when avaialbleGravatar Numerlor2021-03-05-1/+5
| | | | | | | | | | | | |
| * | | | | | | | | | | | Do not set redis results in get_symbol_embedGravatar Numerlor2021-03-05-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The redis results are already being set in the BatchParser for all symbols
| * | | | | | | | | | | | Typo and docstring style changesGravatar Numerlor2021-03-05-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: MarkKoz <[email protected]> fixup! Docstring typos and style changes
| * | | | | | | | | | | | Move the seconds of a week timedelta into a constantGravatar Numerlor2021-03-05-1/+3
| | | | | | | | | | | | |
| * | | | | | | | | | | | Use deque instead of a listGravatar Numerlor2021-03-05-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As we extend the left side of a list now, using a deque that provides a direct method for it is more fitting. fixup! Use deque instead of a list
| * | | | | | | | | | | | Use common check for early exitGravatar Numerlor2021-03-05-11/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces a possibly redundant check for the doc_item being None but results in flatter code with less duplication
| * | | | | | | | | | | | Add new symbols to front of queue instead of extending the endGravatar Numerlor2021-02-28-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using extend caused old items, including the ones that were requested by users and pushed to the front, to be pushed back by all of the items on the new page, possibly significantly delaying their parsing