mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-07 09:52:30 -05:00
Use the commands module instead of checks for permission decorators (#5463)
Co-authored-by: Flame442 <34169552+Flame442@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import List, Tuple, Optional, Dict, Union
|
||||
from typing import Optional, Dict, Union
|
||||
from datetime import datetime
|
||||
|
||||
import discord
|
||||
|
||||
@@ -11,7 +11,7 @@ from .converters import MuteTime
|
||||
from .voicemutes import VoiceMutes
|
||||
|
||||
from redbot.core.bot import Red
|
||||
from redbot.core import commands, checks, i18n, modlog, Config
|
||||
from redbot.core import commands, i18n, modlog, Config
|
||||
from redbot.core.utils import AsyncIter, bounded_gather, can_user_react_in
|
||||
from redbot.core.utils.chat_formatting import (
|
||||
bold,
|
||||
@@ -789,7 +789,7 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
|
||||
|
||||
@muteset.command()
|
||||
@commands.guild_only()
|
||||
@checks.mod_or_permissions(manage_channels=True)
|
||||
@commands.mod_or_permissions(manage_channels=True)
|
||||
async def senddm(self, ctx: commands.Context, true_or_false: bool):
|
||||
"""Set whether mute notifications should be sent to users in DMs."""
|
||||
await self.config.guild(ctx.guild).dm.set(true_or_false)
|
||||
@@ -800,7 +800,7 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
|
||||
|
||||
@muteset.command()
|
||||
@commands.guild_only()
|
||||
@checks.mod_or_permissions(manage_channels=True)
|
||||
@commands.mod_or_permissions(manage_channels=True)
|
||||
async def showmoderator(self, ctx, true_or_false: bool):
|
||||
"""Decide whether the name of the moderator muting a user should be included in the DM to that user."""
|
||||
await self.config.guild(ctx.guild).show_mod.set(true_or_false)
|
||||
@@ -830,7 +830,7 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
|
||||
await ctx.send(_("Okay I will allow channel overwrites for muting users."))
|
||||
|
||||
@muteset.command(name="settings", aliases=["showsettings"])
|
||||
@checks.mod_or_permissions(manage_channels=True)
|
||||
@commands.mod_or_permissions(manage_channels=True)
|
||||
async def show_mutes_settings(self, ctx: commands.Context):
|
||||
"""
|
||||
Shows the current mute settings for this guild.
|
||||
@@ -856,7 +856,7 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
|
||||
await ctx.maybe_send_embed(msg)
|
||||
|
||||
@muteset.command(name="notification")
|
||||
@checks.admin_or_permissions(manage_channels=True)
|
||||
@commands.admin_or_permissions(manage_channels=True)
|
||||
async def notification_channel_set(
|
||||
self,
|
||||
ctx: commands.Context,
|
||||
@@ -878,7 +878,7 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
|
||||
)
|
||||
|
||||
@muteset.command(name="role")
|
||||
@checks.admin_or_permissions(manage_roles=True)
|
||||
@commands.admin_or_permissions(manage_roles=True)
|
||||
@commands.bot_has_guild_permissions(manage_roles=True)
|
||||
async def mute_role(self, ctx: commands.Context, *, role: discord.Role = None):
|
||||
"""Sets the role to be applied when muting a user.
|
||||
@@ -916,7 +916,7 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
|
||||
)
|
||||
|
||||
@muteset.command(name="makerole")
|
||||
@checks.admin_or_permissions(manage_roles=True)
|
||||
@commands.admin_or_permissions(manage_roles=True)
|
||||
@commands.bot_has_guild_permissions(manage_roles=True)
|
||||
@commands.max_concurrency(1, commands.BucketType.guild)
|
||||
async def make_mute_role(self, ctx: commands.Context, *, name: str):
|
||||
@@ -1002,7 +1002,7 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
|
||||
return channel.mention
|
||||
|
||||
@muteset.command(name="defaulttime", aliases=["time"])
|
||||
@checks.mod_or_permissions(manage_messages=True)
|
||||
@commands.mod_or_permissions(manage_messages=True)
|
||||
async def default_mute_time(self, ctx: commands.Context, *, time: Optional[MuteTime] = None):
|
||||
"""
|
||||
Set the default mute time for the mute command.
|
||||
@@ -1107,7 +1107,7 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
|
||||
|
||||
@commands.command()
|
||||
@commands.guild_only()
|
||||
@checks.mod_or_permissions(manage_roles=True)
|
||||
@commands.mod_or_permissions(manage_roles=True)
|
||||
async def activemutes(self, ctx: commands.Context):
|
||||
"""
|
||||
Displays active mutes on this server.
|
||||
@@ -1170,7 +1170,7 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
|
||||
|
||||
@commands.command(usage="<users...> [time_and_reason]")
|
||||
@commands.guild_only()
|
||||
@checks.mod_or_permissions(manage_roles=True)
|
||||
@commands.mod_or_permissions(manage_roles=True)
|
||||
async def mute(
|
||||
self,
|
||||
ctx: commands.Context,
|
||||
@@ -1321,7 +1321,7 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
|
||||
@commands.command(
|
||||
name="mutechannel", aliases=["channelmute"], usage="<users...> [time_and_reason]"
|
||||
)
|
||||
@checks.mod_or_permissions(manage_roles=True)
|
||||
@commands.mod_or_permissions(manage_roles=True)
|
||||
@commands.bot_has_guild_permissions(manage_permissions=True)
|
||||
async def channel_mute(
|
||||
self,
|
||||
@@ -1411,7 +1411,7 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
|
||||
|
||||
@commands.command(usage="<users...> [reason]")
|
||||
@commands.guild_only()
|
||||
@checks.mod_or_permissions(manage_roles=True)
|
||||
@commands.mod_or_permissions(manage_roles=True)
|
||||
async def unmute(
|
||||
self,
|
||||
ctx: commands.Context,
|
||||
@@ -1478,7 +1478,7 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
|
||||
if issue_list:
|
||||
await self.handle_issues(ctx, issue_list)
|
||||
|
||||
@checks.mod_or_permissions(manage_roles=True)
|
||||
@commands.mod_or_permissions(manage_roles=True)
|
||||
@commands.command(name="unmutechannel", aliases=["channelunmute"], usage="<users...> [reason]")
|
||||
@commands.bot_has_guild_permissions(manage_permissions=True)
|
||||
async def unmute_channel(
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
from typing import Optional, Tuple, Union
|
||||
from typing import Optional, Tuple
|
||||
from datetime import timezone, timedelta, datetime
|
||||
from .abc import MixinMeta
|
||||
|
||||
import discord
|
||||
from redbot.core import commands, checks, i18n, modlog
|
||||
from redbot.core import commands, i18n, modlog
|
||||
from redbot.core.utils.chat_formatting import (
|
||||
bold,
|
||||
humanize_timedelta,
|
||||
humanize_list,
|
||||
pagify,
|
||||
|
||||
Reference in New Issue
Block a user