mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-20 18:06:08 -05:00
[Mutes] Add ability to send DMs on mute/unmute (#4563)
* handle manual mutes/unmutes Doing this in the Web-Editor is painful. Let's switch to VSC. * embed version * non embed * config stuff * testing done * wow black * Few things before I start local testing * Fix new lines * Make messages not depend on modlog * Yay voicemutes * black+import * what is your ducking problem vscode * adress review * this is driving me mad * Check the config in `_send_dm_notification` to avoid code repetition * Fix incorrect type hints * Remove no longer needed line changes * Remove unused function * Update the type hints from commit 946299 in the MixinMeta too * Fixed wrong variable being passed to the method and ensure DMs aren't sent when we couldn't get the member object * They call me dumb for a reason * Stop overriding variable with duration + various formatting tweaks * :( * We need to differ between voice and text in two places, interesting... * Show info about no reason provided in embed * Apparently, the `reason` can also be an empty string :| * Update redbot/cogs/mutes/mutes.py Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com> Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
from typing import Optional, Tuple
|
||||
from typing import Optional, Tuple, Union
|
||||
from datetime import timezone, timedelta, datetime
|
||||
from .abc import MixinMeta
|
||||
|
||||
import discord
|
||||
from redbot.core import commands, checks, i18n, modlog
|
||||
from redbot.core.utils.chat_formatting import (
|
||||
bold,
|
||||
humanize_timedelta,
|
||||
humanize_list,
|
||||
pagify,
|
||||
@@ -143,6 +144,9 @@ class VoiceMutes(MixinMeta):
|
||||
until=until,
|
||||
channel=channel,
|
||||
)
|
||||
await self._send_dm_notification(
|
||||
user, author, guild, _("Voice mute"), reason, duration
|
||||
)
|
||||
async with self.config.member(user).perms_cache() as cache:
|
||||
cache[channel.id] = success["old_overs"]
|
||||
else:
|
||||
@@ -216,6 +220,9 @@ class VoiceMutes(MixinMeta):
|
||||
until=None,
|
||||
channel=channel,
|
||||
)
|
||||
await self._send_dm_notification(
|
||||
user, author, guild, _("Voice unmute"), reason
|
||||
)
|
||||
else:
|
||||
issue_list.append((user, success["reason"]))
|
||||
if success_list:
|
||||
|
||||
Reference in New Issue
Block a user