74 Commits

Author SHA1 Message Date
Ianardo DiCaprio
de4804863a [Mod] Option to DM user with kick/ban reason. (#2990)
* FUCK

* FUCK

* FUCK

* Update kickban.py

* Update settings.py

* Update kickban.py

* Update kickban.py

* Add files via upload

* black

* Update kickban.py

* Update kickban.py

* Update redbot/cogs/mod/kickban.py

Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com>

* Update redbot/cogs/mod/kickban.py

Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com>

* Update settings.py

* Update kickban.py

* Update and rename 2990.enhance.rst.txt.txt to 2990.enhance.rst.txt

* Update settings.py

* Rename 2990.enhance.rst.txt to 2990.enhance.rst

* Update redbot/cogs/mod/kickban.py

Co-Authored-By: DevilXD <DevilXD@users.noreply.github.com>

* Update redbot/cogs/mod/kickban.py

Co-Authored-By: DevilXD <DevilXD@users.noreply.github.com>

* Update redbot/cogs/mod/settings.py

Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com>

* Update redbot/cogs/mod/settings.py

Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com>

* Update changelog.d/mod/2990.enhance.rst

Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com>

* Update redbot/cogs/mod/settings.py

Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com>

* Update redbot/cogs/mod/settings.py

Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com>

* Update redbot/cogs/mod/kickban.py

Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com>

* Update redbot/cogs/mod/kickban.py

Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com>

* Update kickban.py

* Update settings.py

* Update kickban.py

* Update kickban.py

* Update redbot/cogs/mod/kickban.py

Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com>

* Update kickban.py

* Update kickban.py

* Update mod.py

* Update settings.py

* Fix SyntaxError

* Don't pass "No reason was given." to modlog case

* Update settings.py

* Update 2990.enhance.rst

* black

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
Co-authored-by: DevilXD <DevilXD@users.noreply.github.com>
2020-01-26 04:18:13 +01:00
Ianardo DiCaprio
1755334124 [Mod] Default days in [p]ban command are now configurable (#2930)
* Initial Commit

* Added changelog

* Update redbot/cogs/mod/settings.py

Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com>

* Update redbot/cogs/mod/settings.py

Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com>

* Update redbot/cogs/mod/settings.py

Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com>

* Update redbot/cogs/mod/settings.py

Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com>

* Rename 2930.enhance.rst.txt to 2930.enhance.rst

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2020-01-23 20:37:11 +01:00
Ianardo DiCaprio
b1ccfab6d2 [Mod] BugFix (#2932)
* Initial Commit

* Add files via upload
2019-08-13 14:33:03 -04:00
DiscordLiz
20091cc10a [ModLog API] Add default casetypes, remove need for a specific auditlog action (#2901)
* I know this needs a changelog entry and docs still

* update tests for new behavior

* update docs, filter; add changelog

* Ready for review

* stop fetching the same Audit logs when the bot is the mod

* I forgot to press save

* fix a comprehension

* Fix AttributeError

* And the other place that happens

* timing fixes
2019-07-27 15:37:29 -04:00
DevilXD
aac9369f3f [Mod] Add [p]slowmode (#2734)
Makes use of new timedelta converter
2019-05-29 10:01:27 +10:00
Michael H
ad114295e7
Discord.py dep update 3.1 (#2587)
* Dependency update

discord.py==1.0.1
websockets<7

[style]
black==19.3b0

[Docs]
jinja==2.10.1
urllib3==1.24.2

Changes related to breaking changes from discord.py have also been made
to match

As of this commit, help formatter is back to discord.py's default
2019-04-23 21:40:38 -04:00
jack1142
460b4bb3f2 [Mod] Allow admins to choose amount of repeats for "deleterepeats" (#2437)
* 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
2019-04-23 10:01:20 -04:00
Michael H
c7608aeb17 [V3 Mod] Use a composite class for mod (#2501)
* [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
2019-04-01 03:34:27 -08:00
Toby Harradine
628073cbe1
Update Translations (#2486)
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>
2019-03-04 08:55:01 +11:00
Michael H
d13bf37845 [Utils] Add filters for spoiler markdown (#2401)
This also wraps some fields of the modlog with the same sanitization, as well as the `[p]names` command.
2019-02-16 11:34:38 +11:00
Twentysix
99ad01ae0d
[p]userinfo: Handle target w/ 'None' Member.joined_at (#2426) 2019-02-07 22:40:40 +01:00
Michael H
3ef693a259 prevent traceback (#2406)
* prevent traceback related to  Rapptz/discord.py#1638

* formatting
2019-02-02 11:20:17 +01:00
Toby Harradine
e07408161a Merge branch 'V3/release/3.0.0' into V3/develop
# Conflicts:
#	redbot/cogs/mod/mod.py
2019-01-11 16:42:42 +11:00
Toby Harradine
8eb8848898
[Mod] Context-based voice checks (#2351)
- 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>
2019-01-10 11:35:37 +11:00
Twentysix
937d2fe0f6
[Mod] Enhanced [p]hackban (#2164) 2019-01-05 03:29:05 +01:00
Toby Harradine
bdcb69ad37 Merge branch 'V3/release/3.0.0' into V3/develop
# Conflicts:
#	redbot/cogs/audio/audio.py
2018-12-21 13:37:32 +11:00
Kowlin
a5efdc6492 [Mod] Handle invalid nicknames in [p]rename (#2311) 2018-12-16 11:21:36 +11:00
Kowlin
38b15ded87 [Mod] Fixed loud RuntimeError on modlog cases (#2331) 2018-12-16 10:26:48 +11:00
Kowlin
2846dce6ea [Mod] [p]modset: Fix KeyError (#2279)
Co-authored-by: aikaterna <20862007+aikaterna@users.noreply.github.com>
2018-11-14 23:35:56 +01:00
FixedThink
6470bc1cda [Mod] [p]userinfo: Get avatar format with proper method (#2291) 2018-11-14 22:46:01 +01:00
Kowlin
92dbd14006
Fixes typos in permissions (#2288)
causing the checks to be thrown out of the window.
2018-11-05 04:19:54 +01:00
Toby Harradine
b5fd28ef7c
[CustomCom] Better display for [p]cc list (#2215)
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>
2018-10-16 08:39:44 +11:00
zephyrkul
6022c0f7d7 [Mod] Mute/unmute bugfixes (#2230)
- 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.
2018-10-12 15:47:39 +11:00
zephyrkul
9e13ca45e6 [Mod] Fix KeyError in modset (#2208) 2018-10-09 09:04:51 +11:00
Toby Harradine
71eddc89ea [Mod] Fix unresolved reference to Member.permissions in reinvite logic
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2018-10-07 09:42:25 +11:00
Toby Harradine
443f2ca556 [i18n] Pass over modlog, permissions, reports, streams, trivia, warnings
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2018-10-06 09:01:04 +10:00
Toby Harradine
fa692ccc0b [i18n] Pass over economy, filter, general, image, mod
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2018-10-06 09:00:31 +10:00
Michael H
aa8c9c350e [i18n] Start work on named format arguments (#1795) 2018-10-06 08:42:38 +10:00
zephyrkul
54dad2a604 [Mod] Use list.copy() for tempban expirations (#2166)
Fixes an error left behind from #2161 (modifying a list while iterating over it)
2018-10-02 18:46:11 +10:00
zephyrkul
a9b328ff3c [Mod] Remove tempban from data after unbanning (#2161)
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.
2018-10-01 14:15:51 +10:00
Toby Harradine
0870403299
Permissions redesign (#2149)
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>
2018-10-01 13:19:25 +10:00
Michael H
f8558b98c1 Automated mod action immunity settings (#2129)
Refactors, and fixes some logic in filter which was encountered while
applying the settings to core
2018-09-25 11:30:28 +10:00
Michael H
404800c556 Hackban fixes (#2128)
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.
2018-09-24 18:21:21 +10:00
Michael H
9495432b8f More mention filtering (#2081)
* 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
2018-09-04 12:59:59 +10:00
Michael H
77944e195a Output sanitisation (#1942)
* 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
2018-08-24 23:50:38 +10:00
Kowlin
591ed50ac3 [Mod] Omit empty fields from [p]userinfo (#1829)
* Hide roles if none are found.

* Clarify about omitted fields in help doc
2018-08-11 13:59:43 +10:00
El Laggron
43c7bd48c7 [V3 Mod] Fix wrong reason used for modlog (#1842) 2018-07-12 03:54:32 +02:00
Toby Harradine
c0d01f32a6 [V3] Use our own checks instead of discord.py's (#1861)
* [V3] Use our own checks instead of discord.py's

* Remove bot.has_permissions checks too
2018-07-12 02:33:39 +02:00
Michael H
1c2196f78f autohelp changes. (#1836) 2018-07-12 01:23:18 +02:00
Michael H
3bcf375204 [V3] Fix duplicate help on ignore (#1862) 2018-06-25 22:00:56 +10:00
Michael H
d23620727e [V3 Mod] Userinfo past nicks/names (#1865)
* [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
2018-06-20 19:49:01 +02:00
Michael H
31612aae4a [V3 Mod] Fix [p]modset used without a subcommand (#1854) 2018-06-11 22:02:29 +10:00
Michael H
49b80e9fe3 [V3 Report] Patch issue with attachment grabbing (#1822)
* 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
2018-06-08 21:08:00 -04:00
Michael H
17c7dd658d [V3 Core] Command group automatic help (#1790)
* decorator inheritence

* black format

* add autohelp

* modify commands to use autohelp
2018-06-08 20:54:36 -04:00
Michael H
8b15053dd4 [V3 Mod/Modlog] prevent self-casing the bot + feedback for heirarchy (#1777)
* 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
2018-06-08 20:27:07 -04:00
Eslyium
60a72b2ba4 [V3] Cleanup quotes in cogs (#1782)
* 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
2018-06-07 00:42:59 -04:00
palmtree5
05ad3fcd5c
[V3 Modlog] add events for modlog cases (#1717)
* 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
2018-05-27 21:18:50 -08:00
aikaterna
f1fea38712 [V3 Mod] Unmute server does not need channel (#1695) 2018-05-28 05:36:44 +02:00
palmtree5
5c9b1c9a3d Move [p]userinfo to Mod + refactor [p]names (#1719) 2018-05-28 03:23:24 +02:00
Michael H
d3f406a34a [V3 Travis] Update travis to not skip pipfile lock... (#1678)
* 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

* .
2018-05-18 17:48:22 -08:00