aboutsummaryrefslogtreecommitdiffstats
path: root/tests/helpers.py (unfollow)
Commit message (Collapse)AuthorLines
2021-04-17Tests: members shouldn't have any public flagsGravatar Matteo Bertucci-0/+8
2021-04-17Move the verified developer badge to the embed titleGravatar Matteo Bertucci-3/+5
2021-04-17Make YAMLGetter raise AttributeError instead of KeyErrorGravatar Matteo Bertucci-3/+4
Utility functions such as hasattr or getattr except __getattribute__ to raise AttributeError not KeyError. This commit also lowers the logging level of the error message to info since it is up to the caller to decide if this is an expected failure or not.
2021-04-16Raise a new NotInBlacklistCheckFailure insteadGravatar mbaruh-7/+15
This creates a new baseclass called ContextCheckFailure, and the new error as well as InWhitelistCheckFailure now derive it.
2021-04-15Allow eval almost everywhereGravatar mbaruh-5/+44
Adds a check to blacklist a command only in a specific context, with an option for a role override. The check is applied to the eval command to blacklist it only from python-general.
2021-04-15chore: update wording as requestedGravatar vcokltfre-3/+3
2021-04-14Refactor embed to use just one lineGravatar Chris-3/+1
2021-04-14Catch NotFound errors when trying to delete the invocation message when cleaningGravatar Chris-2/+6
This often happens during a raid, when an int e script is added to ban & clean messages. Since the invocation message will be deleted on the first run, we should except subsequent NotFound errors.
2021-04-14Require at least one snowflake to be provided.Gravatar Chris-0/+3
2021-04-14Use a paginated embed to output multiple snowflakesGravatar Chris-9/+18
Previously each snowflake passed to the command would have their own embed, which may cause the bot to send many embeds if a staff unknowingly passed it a bunch of snowflakes. This change makes sure that we don't run into rate limits on the bot by sending all of the snowflakes in one embed.
2021-04-13Branding: adjust duration string for 1-day eventsGravatar kwzrd-0/+5
Instead of: 'January 1 - January 1' Do: 'January 1'
2021-04-13Branding: use tz-aware datetime representationGravatar kwzrd-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.
2021-04-12Remove reactions from everyone when paginating and waiting for trashcan ↵Gravatar ToxicKidz-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]>
2021-04-12Use == instead of str.startswithGravatar ToxicKidz-2/+3
2021-04-11Sort the available help channels in #how-to-get-help by positionGravatar ToxicKidz-1/+3
2021-04-11Filtering: use a more thorough regex for zalgo & invisible charsGravatar MarkKoz-35/+91
Install the regex package to take advantage of its support for Unicode categories.
2021-04-11Recruitment: Don't use emoji literalsGravatar Matteo Bertucci-9/+9
2021-04-09AntiSpam: create tasks in a safer mannerGravatar MarkKoz-8/+9
Name the tasks and use `scheduling.create_task` to ensure exceptions are caught.
2021-04-09AntiSpam: prevent attempts to punish a user multiple timesGravatar MarkKoz-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
2021-04-09Filtering: remove invisible characters before checking filtersGravatar MarkKoz-0/+22
2021-04-08Added how_to_get_help channel constant.Gravatar Xithrius-0/+2
2021-04-08Close voice channels with defcon shutdownGravatar onerandomusername-2/+2
2021-04-08update commentGravatar Numerlor-1/+1
2021-04-08Use 'Similar names' instead of 'moved' in footerGravatar Numerlor-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]>
2021-04-07Use the UK version of the YouTube TOSGravatar Ben Soyka-3/+3
2021-04-07Update YouTube terms in the ytdl tagGravatar Ben Soyka-4/+4
2021-04-07rename function to in_any_channel in accordance with d.py namingGravatar vcokltfre-4/+4
2021-04-07update wording to emphasise checks not decoratorsGravatar vcokltfre-3/+3