| Commit message (Collapse) | Author | Age | Lines |
| |
|
|
|
|
| |
Is **very** convenient when writing utility functions that rely on the
bot's state, but aren't in cogs and therefore lack the typical way to
access the instance. No more passing around of the instance as an arg!
|
| |
|
|
|
|
|
| |
It doesn't make sense for it to be at 1000 when the code gets truncated
to 1000 as well.
Fixes #1239
|
| |
|
|
|
|
|
|
|
| |
This could be reproduced by editing a tracked message to a single line
of invalid Python that lacks any back ticks. The code was assuming there
would be multiple lines because that's what the default value for the
threshold is, but this threshold is not applied to edited messages.
Fixes BOT-A5
|
| |\
| |
| |
| |
| | |
python-discord/bug/utility/829/non-py-code-detection
Code block detection rewrite
|
| | | |
|
| | |\
| | |
| | |
| | |
| | |
| | |
| | | |
* Use absolute imports in the code block modules for consistency
* Move has_lines utility function into the helpers module
* Prefix names of code block modules with underscores so they won't
get picked up as extensions by the extension manager
|
| | | |
| | |
| | |
| | | |
It's used for code copied from the Python REPL.
|
| | |\ \ |
|
| | | | |
| | | |
| | | |
| | | | |
A for loop is less confusing according to reviews.
|
| | | | | |
|
| | | | |
| | | |
| | | |
| | | | |
Simplify the code by removing the need to check if the category is None.
|
| | |\ \ \ |
|
| | | | | |
| | | | |
| | | | |
| | | | | |
Fix #497
|
| | |\ \ \ \ |
|
| | | | | | |
| | | | | |
| | | | | |
| | | | | | |
If it's indented too far, the AST parser will fail.
|
| | | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
It's still useful to fix indentation to ensure AST is correctly parsed.
This function deals with the relatively common case of a the leading
spaces of the first line being left out when copy-pasting.
|
| | | | | | | |
|
| | | | | | |
| | | | | |
| | | | | |
| | | | | | |
Forgot to change the kwarg names when the attributes were renamed.
|
| | | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
It was still using it like it was a method of the class rather than
calling it from the channel utils module.
|
| | | | | | |
| | | | | |
| | | | | |
| | | | | | |
It wasn't clear that it also parses the message content.
|
| | | | | | | |
|
| | | | | | | |
|
| | | | | | |
| | | | | |
| | | | | |
| | | | | | |
The declaration was a bit hidden between the two regular expressions.
|
| | | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
The `has_` prefix it clarifies that they're booleans.
Co-authored-by: Numerlor <[email protected]>
|
| | |\ \ \ \ \
| | | | | | |
| | | | | | |
| | | | | | | |
bug/utility/829/non-py-code-detection
|
| | | | | | | | |
|
| | | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
* Increment `codeblock_corrections` when instructions are sent
* Import our Bot subclass instead of discord.py's
|
| | | | | | | | |
|
| | | | | | | | |
|
| | | | | | | | |
|
| | | | | | | | |
|
| | | | | | | | |
|
| | | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
* Change `is_help_channel` to`internally use `is_in_category`
|
| | | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
* Add docstrings for modules
* Rephrase some docstrings and comments
* Fix the grammar of some comments
|
| | | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
When the code block had invalid ticks, instructions for syntax
highlighting were being shown despite the code block having a valid
language.
|
| | | | | | | | |
|
| | | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
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
|
| | | | | | | | |
|
| | | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
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.
|
| | | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
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
|
| | | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
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.
|
| | | | | | | | |
|
| | | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
* Rename to `send_instructions` to be consistent with the use of
"instructions" rather than "guide" elsewhere
* Rename the `description` parameter to `instructions`
|
| | | | | | | | |
|
| | | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
If statement was separated so there could be separate messages that are
more specific. The message ID was also included to distinguish events.
|
| | | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
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.
|
| | | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
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.
|
| | | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Not only is it cleaner and more testable, but it allows for other
functions to also retrieve instructions.
|
| | | | | | | | |
|
| | | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
`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.
|