aboutsummaryrefslogtreecommitdiffstats
path: root/tests/helpers.py (unfollow)
Commit message (Collapse)AuthorLines
2020-02-22awaited can_run CoroutineGravatar F4zii-1/+1
2020-02-22Handling CommandError and OptimizationGravatar F4zii-6/+5
After CommandError was catched, the embed was sent, now we return after the exception was catched Modified the way raw_commands are collected
2020-02-21Only replace the misspelt command, and not the whole occurrences of itGravatar F4zii-1/+1
2020-02-21Handling and logging CommandErrorGravatar F4zii-10/+14
the CommandError exception was ignored, We now catch the exception to handle and log the event Also added a little code reformat
2020-02-20Command suggestion message reformat.Gravatar F4zi-2/+6
The message sent when suggesting a command is now wrapped inside an embed
2020-02-20Rearrange - Function naming and DocstringsGravatar F4zii-105/+81
get_command was changed to - display_tag, the name didn't fit, since its not the command itself. command_on_cooldown was taken out of display_tag to get the option to reuse it in another scope Docstrings modified
2020-02-20Rearrange - Function naming and DocstringsGravatar F4zii-1/+1
2020-02-19Return Logic FixedGravatar F4zii-2/+1
The returned value was changed from True to False If we didn't return True (sent the tag) throughout the code It means we didn't send anything, we should return False
2020-02-19Rearrange, NoneTypes handlingGravatar F4zii-3/+3
2020-02-19Rearrange, Function naming and DocstringsGravatar F4zii-5/+16
2020-02-19Rearrange, exception and NoneTypes handlingGravatar F4zii-12/+16
2020-02-19Removal of unused logsGravatar F4zii-3/+0
2020-02-19Suggest aliases when invoked instead of full command nameGravatar F4zii-3/+3
When found a similar command, the bot sent a suggestion about the full command name This was fixed by saving the matching alias and sending it instead of sending the full command name
2020-02-19Delete_after added for suggestion messageGravatar F4zii-1/+2
preventing message spam by the bot when commands are misspelt
2020-02-19Deletion of the consuming rest (*) used in _get_commandGravatar F4zii-2/+1
Since its used to get the input of the command, its not needed again In the function (callback) call
2020-02-19Feature: suggest command usage for misspelt commandsGravatar F4zii-4/+27
Migration to error_handler.py Suggesting misspelt commands, in progress
2020-02-19Seperated tags.get_command into a function and a wrapperGravatar F4zii-23/+15
Updated
2020-02-19Moderation: show avatar in infraction deactivation logGravatar MarkKoz-0/+5
2020-02-18Feature: suggest command usage for misspelt commandsGravatar F4zii-0/+19
2020-02-17Change snekbox api url to internal docker domain.Gravatar scragly-1/+1
NGINX has been dockerised, and proxy passes now reference internal container domains rather than referencing host or external domains. This will have a few extra benefits: - Less external factors involved for resolving the service address - Can work with the same address on development envs - Snekbox can be closed down entirely so it's inaccessible from external networks.
2020-02-15Moderation: show member as a mention in expired infraction logGravatar MarkKoz-1/+1
2020-02-15Moderation: show correct actor in expired infraction logGravatar MarkKoz-3/+4
The bot user was always being used instead of using the actor field of the infraction.
2020-02-15Moderation: add creation date & duration to expired infraction logGravatar MarkKoz-1/+7
Closes #685
2020-02-15Utils: refactor format_infraction_with_duration and support absolute valGravatar MarkKoz-13/+23
The absolute value is useful for preventing negative values in the case that date_to is in the past relative to date_from. * Add an absolute parameter to take the absolute value of the duration * Rename expiry to date_to * Rewrite the docstring
2020-02-14Stop scheduling expiration of permanent infractions on editGravatar Sebastiaan Zeeff-2/+5
https://github.com/python-discord/bot/issues/751 The infraction edit command defined in `bot.cogs.moderation.management` contained a bug causing it to attempt to schedule an expiration task when turning a temporary infraction into a permanent infraction. Since the "expires_at" field of a permanent infractions is `None`, this caused an exception to occur in the scheduler: Traceback (most recent call last): File "/bot/bot/cogs/moderation/scheduler.py", line 415, in _scheduled_task expiry = dateutil.parser.isoparse(infraction["expires_at"]).replace(tzinfo=None) File "/usr/local/lib/python3.7/site-packages/dateutil/parser/isoparser.py", line 37, in func return f(self, str_in, *args, **kwargs) File "/usr/local/lib/python3.7/site-packages/dateutil/parser/isoparser.py", line 134, in isoparse components, pos = self._parse_isodate(dt_str) File "/usr/local/lib/python3.7/site-packages/dateutil/parser/isoparser.py", line 208, in _parse_isodate return self._parse_isodate_common(dt_str) File "/usr/local/lib/python3.7/site-packages/dateutil/parser/isoparser.py", line 213, in _parse_isodate_common len_str = len(dt_str) TypeError: object of type 'NoneType' has no len() I have solved this by adding a check that makes sure we only schedule an expiration task when the `"expires_at"` field has a truthy value (which all valid datetime strings are) using `if request_data['expires_at']`. IMPORTANT NOTE: While it's tempting to just skip the entire scheduling block for permanent infractions, it's essential to unschedule existing expiration tasks for this infraction as we're changing a temporary infraction to a permanent infraction. This commit closes #751
2020-02-12Fix pagniation module for "last page" reactionGravatar mosguinz-1/+1
Fixes #746.
2020-02-09Remove clear reaction from paginatorsGravatar MarkKoz-17/+2
It could be confused with the delete reaction. Clearing reactions manually is rarely a useful feature anyway.
2020-02-07Pin discord.py to 1.3.xGravatar MarkKoz-2/+2
2020-02-07Update discord.py to 1.3.1Gravatar MarkKoz-39/+34
2020-02-06Add missing slash to asking good questions url.Gravatar scragly-1/+1
2020-02-05Move tools and questions guide to under resourcesGravatar scragly-2/+2
After the wiki pages adjustment to the resources page, these two urls are needing to be updated to point to the new correct locations for each page. Tools will be under resources, and Asking Good Questions is a guide, so will be under Guides.
2020-02-05Made searching even stricter by searching from start of each wordGravatar Shirayuki Nekomata-11/+13
- Added regex back to sub and split by non-alphabet. - Now use two pointers to move from words to words.
2020-02-05Removed regex, implemented a stricter letter searching.Gravatar Shirayuki Nekomata-10/+12
2020-02-05Increased default thresholds from just [100, 80] to [100, 90, 80, 70, 60]Gravatar Shirayuki Nekomata-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.
2020-02-05Removed non-alphabets from both search and tag_name when scoring.Gravatar Shirayuki Nekomata-2/+5
- Added a regex to remove non-alphabet ( `[^a-z]` with `re.IGNORECASE` )
2020-02-04Refactored _get_suggestions following Mark's suggestions about inefficiency.Gravatar Shirayuki Nekomata-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.
2020-02-04Fixed _last_fetch not being updated after each api call.Gravatar Shirayuki Nekomata-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.
2020-02-04Use a trailing underscore to avoid name conflicts. Gravatar scragly-2/+2
Previously used a leading underscore, but that's usually meant for non-used names.
2020-02-03Change typehint name for the attachment-log constantGravatar Matteo Bertucci-1/+1
2020-02-03Replace constant attachment-repost by the actual ID of #attachment-logGravatar Matteo Bertucci-4/+3
2020-02-02Update CODEOWNERSGravatar Joseph-1/+1
2020-02-02Remove prometheus related codeGravatar Joseph Banks-272/+128
2020-02-02Update config-default.ymlGravatar Thomas Petersson-0/+1