aboutsummaryrefslogtreecommitdiffstats
path: root/tests/helpers.py (unfollow)
Commit message (Collapse)AuthorLines
2020-06-19Preserve empty string when substituting clydeGravatar MarkKoz-0/+2
2020-06-19Pipenv: add script for html coverage reportGravatar kwzrd-0/+1
Similarly to the `report` script, this removes the need to invoke coverage when generating the html report.
2020-06-17Make sub_clyde case-sensitive and use Cyrillic e'sGravatar MarkKoz-2/+6
The Cyrillic characters are more likely to be rendered similarly to their Latin counterparts than the math sans-serif characters.
2020-06-17Sync: fix guild ID checkGravatar MarkKoz-22/+25
Need to compare the IDs against each other rather than the Guild object against the ID.
2020-06-17Update deletion scheduler to use latest watchlist configurationGravatar Joseph Banks-17/+5
2020-06-17Add LMGTFY to domain blacklistGravatar Joseph Banks-0/+1
2020-06-16Format parameters with a more consistent styleGravatar MarkKoz-19/+19
2020-06-16Add optional type annotations to reason in pardon funcsGravatar MarkKoz-2/+2
2020-06-16Revise inaccurate typehint for Optional reasonGravatar kosayoda-18/+31
2020-06-16Revise inaccurate docstring in RedisCacheGravatar kosayoda-2/+2
2020-06-16Refactor nested if-statementGravatar kosayoda-5/+4
2020-06-15Fix 400 when "clyde" is in webhook usernameGravatar MarkKoz-8/+24
Discord just disallows this name.
2020-06-15Log exception info for failed attachment uploadsGravatar MarkKoz-1/+1
2020-06-15Webhook remover: exit early if message already deletedGravatar MarkKoz-2/+8
2020-06-15Webhook remover: ignore DMs and bot messagesGravatar MarkKoz-0/+4
Can't remove messages in DMs, so don't bother trying.
2020-06-15Token remover: exit early if message already deletedGravatar MarkKoz-3/+22
2020-06-15Token remover: move bot check to on_messageGravatar MarkKoz-21/+10
It just makes more sense to me to filter out messages at an earlier stage.
2020-06-15Token remover: ignore DMsGravatar MarkKoz-0/+13
It's a private channel so there's no risk of a token "leaking". Furthermore, messages cannot be deleted in DMs.
2020-06-15Update bot/resources/tags/customcooldown.mdGravatar Daniel Nash-3/+1
Co-authored-by: Mark <[email protected]>
2020-06-14Sync: ignore 404s in on_user_updateGravatar MarkKoz-13/+18
404s probably mean the user is from another guild.
2020-06-14Sync tests: test listeners ignore events from other guildsGravatar MarkKoz-10/+54
2020-06-14Sync: ignore events from other guildsGravatar MarkKoz-0/+18
2020-06-14Fix check for bot actor in infractionsGravatar MarkKoz-4/+4
The reason None check should be nested to avoid affecting the else/elif statements that follow.
2020-06-14Check infraction reason isn't None before shortening itGravatar MarkKoz-5/+8
2020-06-15Add the C# guild to the whitelistGravatar Dennis Pham-0/+1
2020-06-14Code block: remove needless f-stringsGravatar MarkKoz-3/+3
2020-06-14Code block: add statsGravatar MarkKoz-1/+5
* Increment `codeblock_corrections` when instructions are sent * Import our Bot subclass instead of discord.py's
2020-06-14Code block: simplify retrieval of channel ID from payloadGravatar MarkKoz-1/+1
2020-06-13Code block: add configurable variablesGravatar MarkKoz-21/+41
2020-06-13Create a utility function to count lines in a stringGravatar MarkKoz-2/+13
2020-06-13Code block: adjust logging levelsGravatar MarkKoz-4/+4
2020-06-13Code block: fix missing newline before generic exampleGravatar MarkKoz-1/+1
2020-06-13Move some functions into a new channel utility moduleGravatar MarkKoz-37/+54
* Change `is_help_channel` to`internally use `is_in_category`
2020-06-13Code block: document the cogGravatar MarkKoz-7/+42
* Add docstrings for modules * Rephrase some docstrings and comments * Fix the grammar of some comments
2020-06-13Code block: fix wrong message shown for bad ticks with a valid languageGravatar MarkKoz-1/+1
When the code block had invalid ticks, instructions for syntax highlighting were being shown despite the code block having a valid language.
2020-06-13Code block: don't return bad language instructions if nothing's wrongGravatar MarkKoz-14/+19
2020-06-13Code block: join bad language instructions by spacesGravatar MarkKoz-9/+11
It was a mistake to join them by newlines in the first place. It looks and reads better as a paragraph. * Remove extra space after bad ticks instructions
2020-06-13Code block: fix message content being edited instead of the embedGravatar MarkKoz-1/+1
2020-06-13Code block: add function to create the instructions embedGravatar MarkKoz-2/+7
While it may be simple now, if the embed needs to changed later, it won't need to be done in multiple places since everything can rely on this function to create the embed.
2020-06-13Code block: use regex to parse incorrect languagesGravatar MarkKoz-18/+51
Regex is simpler and more versatile in this case. The functions in the `instructions` module should be more focused on formatting than parsing, so the parsing was moved to the `parsing` module. * Move _PY_LANG_CODES to the `parsing` module * Create a separate function in the `parsing` module to parse bad languages
2020-06-13Code block: create a function to format the example code blocksGravatar MarkKoz-17/+23
First, this reduces code redundancy. Furthermore, it moves the relatively big block of code for checking the language away from `_get_bad_ticks_message` and into its own, smaller unit.
2020-06-13Code block: rename some things to be "private"Gravatar MarkKoz-26/+26
2020-06-13Code block: refactor `send_guide_embed`Gravatar MarkKoz-4/+4
* Rename to `send_instructions` to be consistent with the use of "instructions" rather than "guide" elsewhere * Rename the `description` parameter to `instructions`
2020-06-13Code block: fix error retrieving a deleted instructions messageGravatar MarkKoz-4/+17
2020-06-13Code block: clarify log messages in message edit eventGravatar MarkKoz-9/+6
If statement was separated so there could be separate messages that are more specific. The message ID was also included to distinguish events.
2020-06-13Code block: edit instructions if edited message is still invalidGravatar MarkKoz-5/+7
Editing instructions means the user will always see what is currently relevant to them. Sometimes an incorrect edit could result in a different problem that was not mentioned in the original instructions. This change also fixes detection of fixed messages by using the same detection logic as the original `on_message`. Previously, it considered an edited message without code blocks to be fixed.
2020-06-13Code block: move bot message retrieval to a separate functionGravatar MarkKoz-16/+11
This bot message retrieval is the actual part of `remove_instructions` that will soon get re-used elsewhere. * Remove `remove_instructions` since it became a bit too simple given the separation of bot message retrieval.
2020-06-13Code block: move instructions retrieval to a separate functionGravatar MarkKoz-26/+37
Not only is it cleaner and more testable, but it allows for other functions to also retrieve instructions.
2020-06-13Code block: move instructions deletion to a separate functionGravatar MarkKoz-7/+16
2020-06-13Code block: fix valid code block being parsed as a missing blockGravatar MarkKoz-6/+9
`find_code_blocks` was returning an empty tuple if there was at least one valid code block. However, the caller could not distinguish between that case and simply no code blocks being found. Therefore, None is explicitly returned to distinguish it from a lack of results.