[Warnings] Add setting for warn channel and DMing warns toggle #2929
No reviewers
Labels
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Mrcoolgamer11/Red-DiscordBot!2929
Loading…
Reference in a new issue
No description provided.
Delete branch "patch-1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type
Description of the changes
This adds commands requested in #2800. It allows to toggle warns being sent to DM's, allows to toggle warns being sent to a channel on a server and has a command to set the channel the warns get sent to, if no channel is set it gets sent to the channel the [p]warn command was used in.
Just couple of changes.
Also, from the original issue:
This could be slightly hard to understand, at least for me. I've commented on the original issue, but basically - there already is an option to log warnings into the modlog channel. A second channel with warnings only could be made public tho, so I guess there is some logic behind having it like this ¯\_(ツ)_/¯
This
not toggleshould either be in the if statement itself, or this line removed and the send messages swapped.This really should be just suppressed, if they don't care about mod actions, that's entirely on them.
I don't get the point of this. One shouldn't enforce those, if someone likes to have both of them disabled and still use warns, this should be possible without getting an annoying message on every usage.
Since the purpose of this is to suppress the exception, I recommend
contextlib.suppress()and making sure the only thing inside the suppress block is theawait user.send(...)part.Looks good, I know it looks like a lot of review comments, but these are all just minor string improvements =)
This file should be called
2929.enhance.rstnot2929.enhance.rst.txt@ -76,6 +84,55 @@ class Warnings(commands.Cog):else:If message about warning is sent in different channel, it would be good to still know that command worked from the channel command was sent in, so adding tick here as well would help that.
I saw you marked this as resolved, but from the looks of it you renamed wrong file ;)
Dont take it as a definitive thing but according to https://github.com/Cog-Creators/Red-DiscordBot/blob/V3/develop/.github/CONTRIBUTING.md#47-using-towncrier
This should be
2929.feature.rst@ -1,3 +1,4 @@import contextlibNote really a necesity but...
should be
This one is just a nitpick for import organization 😈
@ -76,6 +84,55 @@ class Warnings(commands.Cog):else:This should be:
This should be:
As a user i'd expect this to show a name/mention of the channel
await ctx.send(_("Warnings will now be sent to set warn channel."))As a user i'd expect this to show a name/mention of the channel
await ctx.send(_("Warns will no longer be sent in the channel."))I know it's not ideal but we shouldn't say this in the affirmative, perhaps it should be changed to
"I will try to send warning to user in DMs."since users can for example block the bot - it's not guaranteed that warned users will get a warning.Same applied to the toggle off message.
The DM feature .. are we expecting it to only send it via DM or send DM as an aditional thing?
We expect it to send to DM as an additional thing, this is a separate setting.
One thing I didn't notice in first review.
Once this and UX stuff pointed out by Draper gets handled, this should be ready to go.
Sinbad pointed out that this needs handling for cases when bot can't send the message in set channel.
Preferred way of doing this would be first checking if bot has permission to send messages in the channel and also catching any HTTP exception that occurs when sending the message.
Would it be possible to inform the author about the DM not being sent if it's enabled?
If the DM fails, the kick/ban will still succeed, but the bot will send a message like
"This user did not receive your case as they have either blocked the bot or disabled DMs."I think this will be much better then just sending a DM without any sort of feedback as of what happened to it.The reason for this is that (to me at least) it tends to happen that someone says they have never been informed about why they're kicked/muted/whatever, but that there is no way for a staff member to actually verify whether that's true or whether they're 🙈. In other words it would ease a lot of moderation arguments and such, especially with warnings.
@FixedThink It would be possible but in my opinion this shouldn't be part of this PR, I would advice making a separate issue with a request for this enhancement.
This should be the only needed change before this can be approved.
@ -76,6 +84,55 @@ class Warnings(commands.Cog):else:channel.mentionwon't work here because:a)
channelvariable isn't a channel objectb) warn channel might not be set at all - bot should then say it will send warnings in the channel command was used in
@ -76,6 +84,55 @@ class Warnings(commands.Cog):else:This should say that warnings will now be sent to the channel command was used in, instead of saying that channel hasn't been set.
And no need to use
.formatif there's nothing to be replaced.@ -76,6 +84,55 @@ class Warnings(commands.Cog):else:Like I said, it should say that warnings will be sent to the channel warn command was used in, similarly to what's said in line 114. Current string isn't true.