* feat(mod): configurable amount of repeats for "deleterepeats"
resolves#2267
* fix(mod): check user input instead of changing it if it's invalid
* fix(mod): only purge cache when argument is valid
* perf(mod): fetch repeats from config only when guild not in cache
* [V3 Mod] Use a composite class for mod
This turns mod.py into acomposite class
I've split things in this up based on purpose, including `movetocore`
`movetocore` is a set of things which likely belong in the core bot and
not relying on mod being loaded.
This is part of #2500
Per discussion in discord, this should be the first thing in #2500
merged
* Move this back,
mod was importable,
and this was intended as non-breaking
* Prevent fix from being lost if merged before this.
see Cog-Creators/Red-DiscordBot#2510
* Move case creation to before sending
see #2515
* fix failed merge done in web
Also included a Makefile recipe which makes use of the Crowdin CLI's `crowdin download` command. This requires whoever is using it to provide the project's API key in an environment variable, but we may automate this at some point.
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
- Removed `redbot.cogs.mod.checks` module
- Moved logic for formatting a user-friendly list of permissions to `redbot.core.utils.chat_formatting`
- `[p]voice(un)ban` and `[p](un)mute voice` now check permissions in the user's voice channel
Resolves#2296.
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
Uses a menu, optionally embedded with respect to the embed settings, for scrolling through the custom command list, each cc with a ~50 character preview. Format is purposefully similar to the help menu.
Resolves#2104.
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
- Helper methods mute_user and unmute_user now take GuildChannel instead of solely TextChannel.
- The bot will not attempt to mute a member with the Administrator permission, as that permission bypasses channel overwrites anyway. The bot will still unmute members with the Administrator permission (see #2076).
- Audit reasons are now specified for mass mutes / unmutes.
- A few typos and missing keyword specifiers were corrected.
- Streamlined some logic and used some already-existing functions.
Resolves#2160.
Also resolves another issue where the bot will error out when getting the guild's invites when it doesn't have the Manage Server permission.
API changes:
- Cogs must now inherit from `commands.Cog` (see #2151 for discussion and more details)
- All functions which are not decorators in the `redbot.core.checks` module are now deprecated in favour of their counterparts in `redbot.core.utils.mod`. This is to make this module more consistent and end the confusing naming convention.
- `redbot.core.checks.check_overrides` function is now gone, overrideable checks can now be created with the `@commands.permissions_check` decorator
- Command, Group, Cog and Context have some new attributes and methods, but they are for internal use so shouldn't concern cog creators (unless they're making a permissions cog!).
- `__permissions_check_before` and `__permissions_check_after` have been replaced: A cog method named `__permissions_hook` will be evaluated as permissions hooks in the same way `__permissions_check_before` previously was. Permissions hooks can also be added/removed/verified through the new `*_permissions_hook()` methods on the bot object, and they will be verified even when permissions is unloaded.
- New utility method `redbot.core.utils.chat_formatting.humanize_list`
- New dependency [`schema`](https://github.com/keleshev/schema)
User-facing changes:
- When a `@bot_has_permissions` check fails, the bot will respond saying what permissions were actually missing.
- All YAML-related `[p]permissions` subcommands now reside under the `[p]permissions acl` sub-group (tbh I still think the whole cog has too many top-level commands)
- The YAML schema for these commands has been changed
- A rule cannot be set as allow and deny at the same time (previously this would just default to allow)
Documentation:
- New documentation for `redbot.core.commands.requires` and `redbot.core.checks` modules
- Renewed documentation for the permissions cog
- `sphinx.ext.doctest` is now enabled
Note: standard discord.py checks will still behave exactly the same way, in fact they are checked before `Requires` is looked at, so they are not overrideable.
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
If the member is in the guild, delegates to existing ban logic.
Additionally, check that we have ban perms prior to attempting to fetch the existing ban list.
Fixes#2127.
* more filters
* note to future people touching this
* chan mentions were almost missed...
* Swap strategies as the previous escaped the mention, while still pinging the user/role
* [i18n] Use redgettext over pygettext
* Clear out autogenerated `messages.pot` files
* Remove redundant `regen_messages.py` files
* Refactor `generate_strings.py` to use redgettext
* Install redgettext in Travis Crowdin job
* Clean up some problematic usages of gettext function
* Reformat
* Replace generate_strings.py with Makefile argument
* Update to redgettext 2.1, use exclusion pattern
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
* Add output sanitization defaults to context.send
Add some common regex filters in redbot.core.utils.common_filters
Add a wrapper for ease of use in bot.send_filtered
Sanitize ModLog Case's user field (other's considered trusted as moderator input)
Sanitize Usernames/Nicks in userinfo command.
Santize Usernames in closing of tunnels.
* Add documentation
* [V3 Mod] Userinfo past nicks/names
Prevents trying to do a string replace on a NoneType
* address root cause as well
* remove extra whitespace that got pasted in from web editor
* This fixes the issue on report's side
* This prevents delete_delay from causing future issues where message objects are needed
* black format pass
* use the tools we have to clean this logic up a lot
* prevent the bot from being a modlog target
* prevent heirarchy issues in mod
* modify this comparison to avoid more complex mocking of the guild object in mod test
* spelling
* Cleanup quotes in cogs
* More quote cleanup that I missed
fixed a little bit of grammar here and there as well.
* [V3 Warnings] Change allowcustomreasons docstring
To help not confuse users who would believe that the command would use allow or disallow.
* Run black reformat
* Give modlog case objects the bot as an attribute
* Dispatch modlog_case_create and modlog_case_edit events
* case.bot, not just bot
* fix a couple more issues resulting from refactor
* Case.edit doesn't need the bot parameter lol
* Make create_case return the case object (because tests)
* Modify create_case docstring
* Fix a docstring
* Update travis to not sip pipfile lock
update pipfile dependencies
additional black formatting pass to conform to black 18.5b
* .
* pin async timeout until further discussion of 3.5 support
* .