mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-05 17:02:32 -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:
@@ -3,7 +3,7 @@ import logging
|
||||
from typing import Tuple, Union
|
||||
|
||||
import discord
|
||||
from redbot.core import Config, checks, commands
|
||||
from redbot.core import Config, commands
|
||||
from redbot.core.i18n import Translator, cog_i18n
|
||||
from redbot.core.utils.chat_formatting import box
|
||||
from redbot.core.utils.mod import get_audit_reason
|
||||
@@ -215,7 +215,7 @@ class Admin(commands.Cog):
|
||||
|
||||
@commands.command()
|
||||
@commands.guild_only()
|
||||
@checks.admin_or_permissions(manage_roles=True)
|
||||
@commands.admin_or_permissions(manage_roles=True)
|
||||
async def addrole(
|
||||
self,
|
||||
ctx: commands.Context,
|
||||
@@ -233,7 +233,7 @@ class Admin(commands.Cog):
|
||||
|
||||
@commands.command()
|
||||
@commands.guild_only()
|
||||
@checks.admin_or_permissions(manage_roles=True)
|
||||
@commands.admin_or_permissions(manage_roles=True)
|
||||
async def removerole(
|
||||
self,
|
||||
ctx: commands.Context,
|
||||
@@ -251,7 +251,7 @@ class Admin(commands.Cog):
|
||||
|
||||
@commands.group()
|
||||
@commands.guild_only()
|
||||
@checks.admin_or_permissions(manage_roles=True)
|
||||
@commands.admin_or_permissions(manage_roles=True)
|
||||
async def editrole(self, ctx: commands.Context):
|
||||
"""Edit role settings."""
|
||||
pass
|
||||
@@ -325,7 +325,7 @@ class Admin(commands.Cog):
|
||||
await ctx.send(_("Done."))
|
||||
|
||||
@commands.group(invoke_without_command=True)
|
||||
@checks.is_owner()
|
||||
@commands.is_owner()
|
||||
async def announce(self, ctx: commands.Context, *, message: str):
|
||||
"""Announce a message to all servers the bot is in."""
|
||||
if not self.is_announcing():
|
||||
@@ -350,7 +350,7 @@ class Admin(commands.Cog):
|
||||
|
||||
@commands.group()
|
||||
@commands.guild_only()
|
||||
@checks.guildowner_or_permissions(administrator=True)
|
||||
@commands.guildowner_or_permissions(administrator=True)
|
||||
async def announceset(self, ctx):
|
||||
"""Change how announcements are sent in this guild."""
|
||||
pass
|
||||
@@ -441,7 +441,7 @@ class Admin(commands.Cog):
|
||||
await ctx.send(box(msg, "diff"))
|
||||
|
||||
@commands.group()
|
||||
@checks.admin_or_permissions(manage_roles=True)
|
||||
@commands.admin_or_permissions(manage_roles=True)
|
||||
async def selfroleset(self, ctx: commands.Context):
|
||||
"""Manage selfroles."""
|
||||
pass
|
||||
@@ -541,7 +541,7 @@ class Admin(commands.Cog):
|
||||
await ctx.send(_("No changes have been made."))
|
||||
|
||||
@commands.command()
|
||||
@checks.is_owner()
|
||||
@commands.is_owner()
|
||||
async def serverlock(self, ctx: commands.Context):
|
||||
"""Lock a bot to its current servers only."""
|
||||
serverlocked = await self.config.serverlocked()
|
||||
|
||||
@@ -3,10 +3,10 @@ import logging
|
||||
from copy import copy
|
||||
from re import search
|
||||
from string import Formatter
|
||||
from typing import Dict, List, Literal
|
||||
from typing import List, Literal
|
||||
|
||||
import discord
|
||||
from redbot.core import Config, commands, checks
|
||||
from redbot.core import Config, commands
|
||||
from redbot.core.i18n import Translator, cog_i18n
|
||||
from redbot.core.utils.chat_formatting import box, pagify
|
||||
from redbot.core.utils.menus import menu
|
||||
@@ -197,7 +197,7 @@ class Alias(commands.Cog):
|
||||
"""Manage global aliases."""
|
||||
pass
|
||||
|
||||
@checks.mod_or_permissions(manage_guild=True)
|
||||
@commands.mod_or_permissions(manage_guild=True)
|
||||
@alias.command(name="add")
|
||||
@commands.guild_only()
|
||||
async def _add_alias(self, ctx: commands.Context, alias_name: str, *, command):
|
||||
@@ -257,7 +257,7 @@ class Alias(commands.Cog):
|
||||
_("A new alias with the trigger `{name}` has been created.").format(name=alias_name)
|
||||
)
|
||||
|
||||
@checks.is_owner()
|
||||
@commands.is_owner()
|
||||
@global_.command(name="add")
|
||||
async def _add_global_alias(self, ctx: commands.Context, alias_name: str, *, command):
|
||||
"""Add a global alias for a command."""
|
||||
@@ -315,7 +315,7 @@ class Alias(commands.Cog):
|
||||
)
|
||||
)
|
||||
|
||||
@checks.mod_or_permissions(manage_guild=True)
|
||||
@commands.mod_or_permissions(manage_guild=True)
|
||||
@alias.command(name="edit")
|
||||
@commands.guild_only()
|
||||
async def _edit_alias(self, ctx: commands.Context, alias_name: str, *, command):
|
||||
@@ -351,7 +351,7 @@ class Alias(commands.Cog):
|
||||
except ArgParseError as e:
|
||||
return await ctx.send(" ".join(e.args))
|
||||
|
||||
@checks.is_owner()
|
||||
@commands.is_owner()
|
||||
@global_.command(name="edit")
|
||||
async def _edit_global_alias(self, ctx: commands.Context, alias_name: str, *, command):
|
||||
"""Edit an existing global alias."""
|
||||
@@ -407,7 +407,7 @@ class Alias(commands.Cog):
|
||||
else:
|
||||
await ctx.send(_("There is no alias with the name `{name}`").format(name=alias_name))
|
||||
|
||||
@checks.mod_or_permissions(manage_guild=True)
|
||||
@commands.mod_or_permissions(manage_guild=True)
|
||||
@alias.command(name="delete", aliases=["del", "remove"])
|
||||
@commands.guild_only()
|
||||
async def _del_alias(self, ctx: commands.Context, alias_name: str):
|
||||
@@ -423,7 +423,7 @@ class Alias(commands.Cog):
|
||||
else:
|
||||
await ctx.send(_("Alias with name `{name}` was not found.").format(name=alias_name))
|
||||
|
||||
@checks.is_owner()
|
||||
@commands.is_owner()
|
||||
@global_.command(name="delete", aliases=["del", "remove"])
|
||||
async def _del_global_alias(self, ctx: commands.Context, alias_name: str):
|
||||
"""Delete an existing global alias."""
|
||||
|
||||
@@ -5,7 +5,7 @@ from typing import Callable, List, Optional, Set, Union
|
||||
|
||||
import discord
|
||||
|
||||
from redbot.core import checks, commands, Config
|
||||
from redbot.core import commands, Config
|
||||
from redbot.core.bot import Red
|
||||
from redbot.core.commands import RawUserIdConverter
|
||||
from redbot.core.i18n import Translator, cog_i18n
|
||||
@@ -176,7 +176,7 @@ class Cleanup(commands.Cog):
|
||||
|
||||
@cleanup.command()
|
||||
@commands.guild_only()
|
||||
@checks.mod_or_permissions(manage_messages=True)
|
||||
@commands.mod_or_permissions(manage_messages=True)
|
||||
@commands.bot_has_permissions(manage_messages=True)
|
||||
async def text(
|
||||
self, ctx: commands.Context, text: str, number: positive_int, delete_pinned: bool = False
|
||||
@@ -232,7 +232,7 @@ class Cleanup(commands.Cog):
|
||||
|
||||
@cleanup.command()
|
||||
@commands.guild_only()
|
||||
@checks.mod_or_permissions(manage_messages=True)
|
||||
@commands.mod_or_permissions(manage_messages=True)
|
||||
@commands.bot_has_permissions(manage_messages=True)
|
||||
async def user(
|
||||
self,
|
||||
@@ -303,7 +303,7 @@ class Cleanup(commands.Cog):
|
||||
|
||||
@cleanup.command()
|
||||
@commands.guild_only()
|
||||
@checks.mod_or_permissions(manage_messages=True)
|
||||
@commands.mod_or_permissions(manage_messages=True)
|
||||
@commands.bot_has_permissions(manage_messages=True)
|
||||
async def after(
|
||||
self,
|
||||
@@ -356,7 +356,7 @@ class Cleanup(commands.Cog):
|
||||
|
||||
@cleanup.command()
|
||||
@commands.guild_only()
|
||||
@checks.mod_or_permissions(manage_messages=True)
|
||||
@commands.mod_or_permissions(manage_messages=True)
|
||||
@commands.bot_has_permissions(manage_messages=True)
|
||||
async def before(
|
||||
self,
|
||||
@@ -412,7 +412,7 @@ class Cleanup(commands.Cog):
|
||||
|
||||
@cleanup.command()
|
||||
@commands.guild_only()
|
||||
@checks.mod_or_permissions(manage_messages=True)
|
||||
@commands.mod_or_permissions(manage_messages=True)
|
||||
@commands.bot_has_permissions(manage_messages=True)
|
||||
async def between(
|
||||
self,
|
||||
@@ -465,7 +465,7 @@ class Cleanup(commands.Cog):
|
||||
|
||||
@cleanup.command()
|
||||
@commands.guild_only()
|
||||
@checks.mod_or_permissions(manage_messages=True)
|
||||
@commands.mod_or_permissions(manage_messages=True)
|
||||
@commands.bot_has_permissions(manage_messages=True)
|
||||
async def messages(
|
||||
self, ctx: commands.Context, number: positive_int, delete_pinned: bool = False
|
||||
@@ -504,7 +504,7 @@ class Cleanup(commands.Cog):
|
||||
|
||||
@cleanup.command(name="bot")
|
||||
@commands.guild_only()
|
||||
@checks.mod_or_permissions(manage_messages=True)
|
||||
@commands.mod_or_permissions(manage_messages=True)
|
||||
@commands.bot_has_permissions(manage_messages=True)
|
||||
async def cleanup_bot(
|
||||
self, ctx: commands.Context, number: positive_int, delete_pinned: bool = False
|
||||
@@ -682,7 +682,7 @@ class Cleanup(commands.Cog):
|
||||
|
||||
@cleanup.command(name="duplicates", aliases=["spam"])
|
||||
@commands.guild_only()
|
||||
@checks.mod_or_permissions(manage_messages=True)
|
||||
@commands.mod_or_permissions(manage_messages=True)
|
||||
@commands.bot_has_permissions(manage_messages=True)
|
||||
async def cleanup_duplicates(
|
||||
self, ctx: commands.Context, number: positive_int = PositiveInt(50)
|
||||
|
||||
@@ -9,7 +9,7 @@ from urllib.parse import quote_plus
|
||||
import discord
|
||||
from rapidfuzz import process
|
||||
|
||||
from redbot.core import Config, checks, commands
|
||||
from redbot.core import Config, commands
|
||||
from redbot.core.i18n import Translator, cog_i18n
|
||||
from redbot.core.utils import menus, AsyncIter
|
||||
from redbot.core.utils.chat_formatting import box, pagify, escape, humanize_list
|
||||
@@ -347,7 +347,7 @@ class CustomCommands(commands.Cog):
|
||||
await ctx.send(_("The following matches have been found:") + box(content))
|
||||
|
||||
@customcom.group(name="create", aliases=["add"], invoke_without_command=True)
|
||||
@checks.mod_or_permissions(administrator=True)
|
||||
@commands.mod_or_permissions(administrator=True)
|
||||
async def cc_create(self, ctx: commands.Context, command: str.lower, *, text: str):
|
||||
"""Create custom commands.
|
||||
|
||||
@@ -358,7 +358,7 @@ class CustomCommands(commands.Cog):
|
||||
await ctx.invoke(self.cc_create_simple, command=command, text=text)
|
||||
|
||||
@cc_create.command(name="random")
|
||||
@checks.mod_or_permissions(administrator=True)
|
||||
@commands.mod_or_permissions(administrator=True)
|
||||
async def cc_create_random(self, ctx: commands.Context, command: str.lower):
|
||||
"""Create a CC where it will randomly choose a response!
|
||||
|
||||
@@ -397,7 +397,7 @@ class CustomCommands(commands.Cog):
|
||||
)
|
||||
|
||||
@cc_create.command(name="simple")
|
||||
@checks.mod_or_permissions(administrator=True)
|
||||
@commands.mod_or_permissions(administrator=True)
|
||||
async def cc_create_simple(self, ctx, command: str.lower, *, text: str):
|
||||
"""Add a simple custom command.
|
||||
|
||||
@@ -436,7 +436,7 @@ class CustomCommands(commands.Cog):
|
||||
)
|
||||
|
||||
@customcom.command(name="cooldown")
|
||||
@checks.mod_or_permissions(administrator=True)
|
||||
@commands.mod_or_permissions(administrator=True)
|
||||
async def cc_cooldown(
|
||||
self, ctx, command: str.lower, cooldown: int = None, *, per: str.lower = "member"
|
||||
):
|
||||
@@ -487,7 +487,7 @@ class CustomCommands(commands.Cog):
|
||||
)
|
||||
|
||||
@customcom.command(name="delete", aliases=["del", "remove"])
|
||||
@checks.mod_or_permissions(administrator=True)
|
||||
@commands.mod_or_permissions(administrator=True)
|
||||
async def cc_delete(self, ctx, command: str.lower):
|
||||
"""Delete a custom command.
|
||||
|
||||
@@ -505,7 +505,7 @@ class CustomCommands(commands.Cog):
|
||||
await ctx.send(_("That command doesn't exist."))
|
||||
|
||||
@customcom.command(name="edit")
|
||||
@checks.mod_or_permissions(administrator=True)
|
||||
@commands.mod_or_permissions(administrator=True)
|
||||
async def cc_edit(self, ctx, command: str.lower, *, text: str = None):
|
||||
"""Edit a custom command.
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ from typing import Tuple, Union, Iterable, Collection, Optional, Dict, Set, List
|
||||
from collections import defaultdict
|
||||
|
||||
import discord
|
||||
from redbot.core import checks, commands, Config, version_info as red_version_info
|
||||
from redbot.core import commands, Config, version_info as red_version_info
|
||||
from redbot.core.bot import Red
|
||||
from redbot.core.data_manager import cog_data_path
|
||||
from redbot.core.i18n import Translator, cog_i18n
|
||||
@@ -480,7 +480,7 @@ class Downloader(commands.Cog):
|
||||
await target.send(page)
|
||||
|
||||
@commands.command(require_var_positional=True)
|
||||
@checks.is_owner()
|
||||
@commands.is_owner()
|
||||
async def pipinstall(self, ctx: commands.Context, *deps: str) -> None:
|
||||
"""
|
||||
Install a group of dependencies using pip.
|
||||
@@ -514,7 +514,7 @@ class Downloader(commands.Cog):
|
||||
)
|
||||
|
||||
@commands.group()
|
||||
@checks.is_owner()
|
||||
@commands.is_owner()
|
||||
async def repo(self, ctx: commands.Context) -> None:
|
||||
"""Base command for repository management."""
|
||||
pass
|
||||
@@ -698,7 +698,7 @@ class Downloader(commands.Cog):
|
||||
await self.send_pagified(ctx, message)
|
||||
|
||||
@commands.group()
|
||||
@checks.is_owner()
|
||||
@commands.is_owner()
|
||||
async def cog(self, ctx: commands.Context) -> None:
|
||||
"""Base command for cog installation management commands."""
|
||||
pass
|
||||
|
||||
@@ -9,7 +9,7 @@ from typing import cast, Iterable, Union, Literal
|
||||
|
||||
import discord
|
||||
|
||||
from redbot.core import Config, bank, commands, errors, checks
|
||||
from redbot.core import Config, bank, commands, errors
|
||||
from redbot.core.commands.converter import TimedeltaConverter
|
||||
from redbot.core.bot import Red
|
||||
from redbot.core.i18n import Translator, cog_i18n
|
||||
@@ -237,7 +237,7 @@ class Economy(commands.Cog):
|
||||
)
|
||||
|
||||
@bank.is_owner_if_bank_global()
|
||||
@checks.admin_or_permissions(manage_guild=True)
|
||||
@commands.admin_or_permissions(manage_guild=True)
|
||||
@_bank.command(name="set")
|
||||
async def _set(self, ctx: commands.Context, to: discord.Member, creds: SetParser):
|
||||
"""Set the balance of a user's bank account.
|
||||
@@ -656,7 +656,7 @@ class Economy(commands.Cog):
|
||||
|
||||
@guild_only_check()
|
||||
@bank.is_owner_if_bank_global()
|
||||
@checks.admin_or_permissions(manage_guild=True)
|
||||
@commands.admin_or_permissions(manage_guild=True)
|
||||
@commands.group()
|
||||
async def economyset(self, ctx: commands.Context):
|
||||
"""Base command to manage Economy settings."""
|
||||
|
||||
@@ -4,7 +4,7 @@ import re
|
||||
from datetime import timezone
|
||||
from typing import Union, Set, Literal, Optional
|
||||
|
||||
from redbot.core import checks, Config, modlog, commands
|
||||
from redbot.core import Config, modlog, commands
|
||||
from redbot.core.bot import Red
|
||||
from redbot.core.i18n import Translator, cog_i18n, set_contextual_locales_from_guild
|
||||
from redbot.core.utils.predicates import MessagePredicate
|
||||
@@ -80,7 +80,7 @@ class Filter(commands.Cog):
|
||||
|
||||
@commands.group()
|
||||
@commands.guild_only()
|
||||
@checks.admin_or_permissions(manage_guild=True)
|
||||
@commands.admin_or_permissions(manage_guild=True)
|
||||
async def filterset(self, ctx: commands.Context):
|
||||
"""Base command to manage filter settings."""
|
||||
pass
|
||||
@@ -144,7 +144,7 @@ class Filter(commands.Cog):
|
||||
|
||||
@commands.group(name="filter")
|
||||
@commands.guild_only()
|
||||
@checks.mod_or_permissions(manage_messages=True)
|
||||
@commands.mod_or_permissions(manage_messages=True)
|
||||
async def _filter(self, ctx: commands.Context):
|
||||
"""Base command to add or remove words from the server filter.
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ from typing import Optional
|
||||
import aiohttp
|
||||
|
||||
from redbot.core.i18n import Translator, cog_i18n
|
||||
from redbot.core import checks, Config, commands
|
||||
from redbot.core import Config, commands
|
||||
from redbot.core.commands import UserInputOptional
|
||||
|
||||
_ = Translator("Image", __file__)
|
||||
@@ -153,7 +153,7 @@ class Image(commands.Cog):
|
||||
_("Something went wrong. Error code is {code}.").format(code=data["status"])
|
||||
)
|
||||
|
||||
@checks.is_owner()
|
||||
@commands.is_owner()
|
||||
@commands.command()
|
||||
async def imgurcreds(self, ctx):
|
||||
"""Explain how to set imgur API tokens."""
|
||||
@@ -228,7 +228,7 @@ class Image(commands.Cog):
|
||||
else:
|
||||
await ctx.send(_("Error contacting the API."))
|
||||
|
||||
@checks.is_owner()
|
||||
@commands.is_owner()
|
||||
@commands.command()
|
||||
async def giphycreds(self, ctx):
|
||||
"""Explains how to set GIPHY API tokens."""
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import List, Tuple, Optional
|
||||
from typing import Optional
|
||||
|
||||
import discord
|
||||
from redbot.core import Config, commands
|
||||
|
||||
@@ -5,8 +5,8 @@ from datetime import datetime, timedelta, timezone
|
||||
from typing import Dict, List, Optional, Tuple, Union
|
||||
|
||||
import discord
|
||||
from redbot.core import commands, i18n, checks, modlog
|
||||
from redbot.core.commands import UserInputOptional, RawUserIdConverter
|
||||
from redbot.core import commands, i18n, modlog
|
||||
from redbot.core.commands import RawUserIdConverter
|
||||
from redbot.core.utils import AsyncIter
|
||||
from redbot.core.utils.chat_formatting import (
|
||||
pagify,
|
||||
@@ -281,7 +281,7 @@ class KickBanMixin(MixinMeta):
|
||||
@commands.command()
|
||||
@commands.guild_only()
|
||||
@commands.bot_has_permissions(kick_members=True)
|
||||
@checks.admin_or_permissions(kick_members=True)
|
||||
@commands.admin_or_permissions(kick_members=True)
|
||||
async def kick(self, ctx: commands.Context, member: discord.Member, *, reason: str = None):
|
||||
"""
|
||||
Kick a user.
|
||||
@@ -359,7 +359,7 @@ class KickBanMixin(MixinMeta):
|
||||
@commands.command()
|
||||
@commands.guild_only()
|
||||
@commands.bot_has_permissions(ban_members=True)
|
||||
@checks.admin_or_permissions(ban_members=True)
|
||||
@commands.admin_or_permissions(ban_members=True)
|
||||
async def ban(
|
||||
self,
|
||||
ctx: commands.Context,
|
||||
@@ -397,7 +397,7 @@ class KickBanMixin(MixinMeta):
|
||||
@commands.command(aliases=["hackban"], usage="<user_ids...> [days] [reason]")
|
||||
@commands.guild_only()
|
||||
@commands.bot_has_permissions(ban_members=True)
|
||||
@checks.admin_or_permissions(ban_members=True)
|
||||
@commands.admin_or_permissions(ban_members=True)
|
||||
async def massban(
|
||||
self,
|
||||
ctx: commands.Context,
|
||||
@@ -571,7 +571,7 @@ class KickBanMixin(MixinMeta):
|
||||
@commands.command()
|
||||
@commands.guild_only()
|
||||
@commands.bot_has_permissions(ban_members=True)
|
||||
@checks.admin_or_permissions(ban_members=True)
|
||||
@commands.admin_or_permissions(ban_members=True)
|
||||
async def tempban(
|
||||
self,
|
||||
ctx: commands.Context,
|
||||
@@ -670,7 +670,7 @@ class KickBanMixin(MixinMeta):
|
||||
@commands.command()
|
||||
@commands.guild_only()
|
||||
@commands.bot_has_permissions(ban_members=True)
|
||||
@checks.admin_or_permissions(ban_members=True)
|
||||
@commands.admin_or_permissions(ban_members=True)
|
||||
async def softban(self, ctx: commands.Context, member: discord.Member, *, reason: str = None):
|
||||
"""Kick a user and delete 1 day's worth of their messages."""
|
||||
guild = ctx.guild
|
||||
@@ -797,7 +797,7 @@ class KickBanMixin(MixinMeta):
|
||||
|
||||
@commands.command()
|
||||
@commands.guild_only()
|
||||
@checks.admin_or_permissions(mute_members=True, deafen_members=True)
|
||||
@commands.admin_or_permissions(mute_members=True, deafen_members=True)
|
||||
async def voiceunban(
|
||||
self, ctx: commands.Context, member: discord.Member, *, reason: str = None
|
||||
):
|
||||
@@ -840,7 +840,7 @@ class KickBanMixin(MixinMeta):
|
||||
|
||||
@commands.command()
|
||||
@commands.guild_only()
|
||||
@checks.admin_or_permissions(mute_members=True, deafen_members=True)
|
||||
@commands.admin_or_permissions(mute_members=True, deafen_members=True)
|
||||
async def voiceban(self, ctx: commands.Context, member: discord.Member, *, reason: str = None):
|
||||
"""Ban a user from speaking and listening in the server's voice channels."""
|
||||
user_voice_state: discord.VoiceState = member.voice
|
||||
@@ -882,7 +882,7 @@ class KickBanMixin(MixinMeta):
|
||||
@commands.command()
|
||||
@commands.guild_only()
|
||||
@commands.bot_has_permissions(ban_members=True)
|
||||
@checks.admin_or_permissions(ban_members=True)
|
||||
@commands.admin_or_permissions(ban_members=True)
|
||||
async def unban(
|
||||
self, ctx: commands.Context, user_id: RawUserIdConverter, *, reason: str = None
|
||||
):
|
||||
|
||||
@@ -3,14 +3,12 @@ import logging
|
||||
import re
|
||||
from abc import ABC
|
||||
from collections import defaultdict
|
||||
from typing import List, Tuple, Literal
|
||||
from typing import Literal
|
||||
|
||||
import discord
|
||||
from redbot.core.utils import AsyncIter
|
||||
|
||||
from redbot.core import Config, modlog, commands
|
||||
from redbot.core import Config, commands
|
||||
from redbot.core.bot import Red
|
||||
from redbot.core.i18n import Translator, cog_i18n
|
||||
from redbot.core.utils import AsyncIter
|
||||
from redbot.core.utils._internal_utils import send_to_owners_with_prefix_replaced
|
||||
from redbot.core.utils.chat_formatting import inline
|
||||
from .events import Events
|
||||
|
||||
@@ -2,7 +2,7 @@ import datetime
|
||||
from typing import cast
|
||||
|
||||
import discord
|
||||
from redbot.core import commands, i18n, checks
|
||||
from redbot.core import commands, i18n
|
||||
from redbot.core.utils.common_filters import (
|
||||
filter_invites,
|
||||
filter_various_mentions,
|
||||
@@ -32,7 +32,7 @@ class ModInfo(MixinMeta):
|
||||
@commands.command()
|
||||
@commands.guild_only()
|
||||
@commands.bot_has_permissions(manage_nicknames=True)
|
||||
@checks.admin_or_permissions(manage_nicknames=True)
|
||||
@commands.admin_or_permissions(manage_nicknames=True)
|
||||
async def rename(self, ctx: commands.Context, member: discord.Member, *, nickname: str = ""):
|
||||
"""Change a member's nickname.
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import asyncio
|
||||
from collections import defaultdict, deque
|
||||
from typing import Optional
|
||||
from datetime import timedelta
|
||||
|
||||
from redbot.core import commands, i18n, checks
|
||||
from redbot.core import commands, i18n
|
||||
from redbot.core.utils import AsyncIter
|
||||
from redbot.core.utils.chat_formatting import box, humanize_timedelta, inline
|
||||
|
||||
@@ -18,7 +17,7 @@ class ModSettings(MixinMeta):
|
||||
"""
|
||||
|
||||
@commands.group()
|
||||
@checks.guildowner_or_permissions(administrator=True)
|
||||
@commands.guildowner_or_permissions(administrator=True)
|
||||
async def modset(self, ctx: commands.Context):
|
||||
"""Manage server administration settings."""
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import discord
|
||||
import re
|
||||
from .abc import MixinMeta
|
||||
from datetime import timedelta
|
||||
from redbot.core import commands, i18n, checks
|
||||
from redbot.core import commands, i18n
|
||||
from redbot.core.utils.chat_formatting import humanize_timedelta
|
||||
|
||||
_ = i18n.Translator("Mod", __file__)
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import asyncio
|
||||
from datetime import datetime, timezone
|
||||
|
||||
from typing import Optional, Union
|
||||
|
||||
import discord
|
||||
|
||||
from redbot.core import checks, commands, modlog
|
||||
from redbot.core import commands, modlog
|
||||
from redbot.core.bot import Red
|
||||
from redbot.core.i18n import Translator, cog_i18n
|
||||
from redbot.core.utils.chat_formatting import bold, box, pagify
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -7,7 +7,7 @@ from typing import Union, Optional, Dict, List, Tuple, Any, Iterator, ItemsView,
|
||||
import discord
|
||||
import yaml
|
||||
from schema import And, Or, Schema, SchemaError, Optional as UseOptional
|
||||
from redbot.core import checks, commands, config
|
||||
from redbot.core import commands, config
|
||||
from redbot.core.bot import Red
|
||||
from redbot.core.i18n import Translator, cog_i18n
|
||||
from redbot.core.utils import can_user_react_in
|
||||
@@ -268,7 +268,7 @@ class Permissions(commands.Cog):
|
||||
)
|
||||
await ctx.send(out)
|
||||
|
||||
@checks.guildowner_or_permissions(administrator=True)
|
||||
@commands.guildowner_or_permissions(administrator=True)
|
||||
@permissions.group(name="acl", aliases=["yaml"])
|
||||
async def permissions_acl(self, ctx: commands.Context):
|
||||
"""Manage permissions with YAML files."""
|
||||
@@ -296,7 +296,7 @@ class Permissions(commands.Cog):
|
||||
)
|
||||
)
|
||||
|
||||
@checks.is_owner()
|
||||
@commands.is_owner()
|
||||
@permissions_acl.command(name="setglobal")
|
||||
async def permissions_acl_setglobal(self, ctx: commands.Context):
|
||||
"""Set global rules with a YAML file.
|
||||
@@ -310,7 +310,7 @@ class Permissions(commands.Cog):
|
||||
await self._permissions_acl_set(ctx, guild_id=GLOBAL, update=False)
|
||||
|
||||
@commands.guild_only()
|
||||
@checks.guildowner_or_permissions(administrator=True)
|
||||
@commands.guildowner_or_permissions(administrator=True)
|
||||
@permissions_acl.command(name="setserver", aliases=["setguild"])
|
||||
async def permissions_acl_setguild(self, ctx: commands.Context):
|
||||
"""Set rules for this server with a YAML file.
|
||||
@@ -320,7 +320,7 @@ class Permissions(commands.Cog):
|
||||
"""
|
||||
await self._permissions_acl_set(ctx, guild_id=ctx.guild.id, update=False)
|
||||
|
||||
@checks.is_owner()
|
||||
@commands.is_owner()
|
||||
@permissions_acl.command(name="getglobal")
|
||||
async def permissions_acl_getglobal(self, ctx: commands.Context):
|
||||
"""Get a YAML file detailing all global rules."""
|
||||
@@ -336,7 +336,7 @@ class Permissions(commands.Cog):
|
||||
file.close()
|
||||
|
||||
@commands.guild_only()
|
||||
@checks.guildowner_or_permissions(administrator=True)
|
||||
@commands.guildowner_or_permissions(administrator=True)
|
||||
@permissions_acl.command(name="getserver", aliases=["getguild"])
|
||||
async def permissions_acl_getguild(self, ctx: commands.Context):
|
||||
"""Get a YAML file detailing all rules in this server."""
|
||||
@@ -350,7 +350,7 @@ class Permissions(commands.Cog):
|
||||
finally:
|
||||
file.close()
|
||||
|
||||
@checks.is_owner()
|
||||
@commands.is_owner()
|
||||
@permissions_acl.command(name="updateglobal")
|
||||
async def permissions_acl_updateglobal(self, ctx: commands.Context):
|
||||
"""Update global rules with a YAML file.
|
||||
@@ -361,7 +361,7 @@ class Permissions(commands.Cog):
|
||||
await self._permissions_acl_set(ctx, guild_id=GLOBAL, update=True)
|
||||
|
||||
@commands.guild_only()
|
||||
@checks.guildowner_or_permissions(administrator=True)
|
||||
@commands.guildowner_or_permissions(administrator=True)
|
||||
@permissions_acl.command(name="updateserver", aliases=["updateguild"])
|
||||
async def permissions_acl_updateguild(self, ctx: commands.Context):
|
||||
"""Update rules for this server with a YAML file.
|
||||
@@ -371,7 +371,7 @@ class Permissions(commands.Cog):
|
||||
"""
|
||||
await self._permissions_acl_set(ctx, guild_id=ctx.guild.id, update=True)
|
||||
|
||||
@checks.is_owner()
|
||||
@commands.is_owner()
|
||||
@permissions.command(name="addglobalrule", require_var_positional=True)
|
||||
async def permissions_addglobalrule(
|
||||
self,
|
||||
@@ -399,7 +399,7 @@ class Permissions(commands.Cog):
|
||||
await ctx.send(_("Rule added."))
|
||||
|
||||
@commands.guild_only()
|
||||
@checks.guildowner_or_permissions(administrator=True)
|
||||
@commands.guildowner_or_permissions(administrator=True)
|
||||
@permissions.command(
|
||||
name="addserverrule", aliases=["addguildrule"], require_var_positional=True
|
||||
)
|
||||
@@ -428,7 +428,7 @@ class Permissions(commands.Cog):
|
||||
)
|
||||
await ctx.send(_("Rule added."))
|
||||
|
||||
@checks.is_owner()
|
||||
@commands.is_owner()
|
||||
@permissions.command(name="removeglobalrule", require_var_positional=True)
|
||||
async def permissions_removeglobalrule(
|
||||
self,
|
||||
@@ -448,7 +448,7 @@ class Permissions(commands.Cog):
|
||||
await ctx.send(_("Rule removed."))
|
||||
|
||||
@commands.guild_only()
|
||||
@checks.guildowner_or_permissions(administrator=True)
|
||||
@commands.guildowner_or_permissions(administrator=True)
|
||||
@permissions.command(
|
||||
name="removeserverrule", aliases=["removeguildrule"], require_var_positional=True
|
||||
)
|
||||
@@ -472,7 +472,7 @@ class Permissions(commands.Cog):
|
||||
await ctx.send(_("Rule removed."))
|
||||
|
||||
@commands.guild_only()
|
||||
@checks.guildowner_or_permissions(administrator=True)
|
||||
@commands.guildowner_or_permissions(administrator=True)
|
||||
@permissions.command(name="setdefaultserverrule", aliases=["setdefaultguildrule"])
|
||||
async def permissions_setdefaultguildrule(
|
||||
self, ctx: commands.Context, allow_or_deny: ClearableRuleType, cog_or_command: CogOrCommand
|
||||
@@ -495,7 +495,7 @@ class Permissions(commands.Cog):
|
||||
)
|
||||
await ctx.send(_("Default set."))
|
||||
|
||||
@checks.is_owner()
|
||||
@commands.is_owner()
|
||||
@permissions.command(name="setdefaultglobalrule")
|
||||
async def permissions_setdefaultglobalrule(
|
||||
self, ctx: commands.Context, allow_or_deny: ClearableRuleType, cog_or_command: CogOrCommand
|
||||
@@ -516,7 +516,7 @@ class Permissions(commands.Cog):
|
||||
)
|
||||
await ctx.send(_("Default set."))
|
||||
|
||||
@checks.is_owner()
|
||||
@commands.is_owner()
|
||||
@permissions.command(name="clearglobalrules")
|
||||
async def permissions_clearglobalrules(self, ctx: commands.Context):
|
||||
"""Reset all global rules."""
|
||||
@@ -526,7 +526,7 @@ class Permissions(commands.Cog):
|
||||
await ctx.tick()
|
||||
|
||||
@commands.guild_only()
|
||||
@checks.guildowner_or_permissions(administrator=True)
|
||||
@commands.guildowner_or_permissions(administrator=True)
|
||||
@permissions.command(name="clearserverrules", aliases=["clearguildrules"])
|
||||
async def permissions_clearguildrules(self, ctx: commands.Context):
|
||||
"""Reset all rules in this server."""
|
||||
|
||||
@@ -6,7 +6,7 @@ from copy import copy
|
||||
import contextlib
|
||||
import discord
|
||||
|
||||
from redbot.core import Config, checks, commands
|
||||
from redbot.core import Config, commands
|
||||
from redbot.core.utils import AsyncIter
|
||||
from redbot.core.utils.chat_formatting import pagify, box
|
||||
from redbot.core.utils.antispam import AntiSpam
|
||||
@@ -97,14 +97,14 @@ class Reports(commands.Cog):
|
||||
def tunnels(self):
|
||||
return [x["tun"] for x in self.tunnel_store.values()]
|
||||
|
||||
@checks.admin_or_permissions(manage_guild=True)
|
||||
@commands.admin_or_permissions(manage_guild=True)
|
||||
@commands.guild_only()
|
||||
@commands.group(name="reportset")
|
||||
async def reportset(self, ctx: commands.Context):
|
||||
"""Manage Reports."""
|
||||
pass
|
||||
|
||||
@checks.admin_or_permissions(manage_guild=True)
|
||||
@commands.admin_or_permissions(manage_guild=True)
|
||||
@reportset.command(name="output")
|
||||
async def reportset_output(
|
||||
self, ctx: commands.Context, channel: Union[discord.TextChannel, discord.VoiceChannel]
|
||||
@@ -113,7 +113,7 @@ class Reports(commands.Cog):
|
||||
await self.config.guild(ctx.guild).output_channel.set(channel.id)
|
||||
await ctx.send(_("The report channel has been set."))
|
||||
|
||||
@checks.admin_or_permissions(manage_guild=True)
|
||||
@commands.admin_or_permissions(manage_guild=True)
|
||||
@reportset.command(name="toggle", aliases=["toggleactive"])
|
||||
async def reportset_toggle(self, ctx: commands.Context):
|
||||
"""Enable or disable reporting for this server."""
|
||||
@@ -388,7 +388,7 @@ class Reports(commands.Cog):
|
||||
)
|
||||
|
||||
@commands.guild_only()
|
||||
@checks.mod_or_permissions(manage_roles=True)
|
||||
@commands.mod_or_permissions(manage_roles=True)
|
||||
@report.command(name="interact")
|
||||
async def response(self, ctx, ticket_number: int):
|
||||
"""Open a message tunnel.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import discord
|
||||
from redbot.core.utils.chat_formatting import humanize_list
|
||||
from redbot.core.bot import Red
|
||||
from redbot.core import checks, commands, Config
|
||||
from redbot.core import commands, Config
|
||||
from redbot.core.i18n import cog_i18n, Translator, set_contextual_locales_from_guild
|
||||
from redbot.core.utils._internal_utils import send_to_owners_with_prefix_replaced
|
||||
from redbot.core.utils.chat_formatting import escape, inline, pagify
|
||||
@@ -305,7 +305,7 @@ class Streams(commands.Cog):
|
||||
|
||||
@commands.group()
|
||||
@commands.guild_only()
|
||||
@checks.mod_or_permissions(manage_channels=True)
|
||||
@commands.mod_or_permissions(manage_channels=True)
|
||||
async def streamalert(self, ctx: commands.Context):
|
||||
"""Manage automated stream alerts."""
|
||||
pass
|
||||
@@ -494,13 +494,13 @@ class Streams(commands.Cog):
|
||||
await self.add_or_remove(ctx, stream, discord_channel)
|
||||
|
||||
@commands.group()
|
||||
@checks.mod_or_permissions(manage_channels=True)
|
||||
@commands.mod_or_permissions(manage_channels=True)
|
||||
async def streamset(self, ctx: commands.Context):
|
||||
"""Manage stream alert settings."""
|
||||
pass
|
||||
|
||||
@streamset.command(name="timer")
|
||||
@checks.is_owner()
|
||||
@commands.is_owner()
|
||||
async def _streamset_refresh_timer(self, ctx: commands.Context, refresh_time: int):
|
||||
"""Set stream check refresh time."""
|
||||
if refresh_time < 60:
|
||||
@@ -512,7 +512,7 @@ class Streams(commands.Cog):
|
||||
)
|
||||
|
||||
@streamset.command()
|
||||
@checks.is_owner()
|
||||
@commands.is_owner()
|
||||
async def twitchtoken(self, ctx: commands.Context):
|
||||
"""Explain how to set the twitch token."""
|
||||
message = _(
|
||||
@@ -538,7 +538,7 @@ class Streams(commands.Cog):
|
||||
await ctx.maybe_send_embed(message)
|
||||
|
||||
@streamset.command()
|
||||
@checks.is_owner()
|
||||
@commands.is_owner()
|
||||
async def youtubekey(self, ctx: commands.Context):
|
||||
"""Explain how to set the YouTube token."""
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import io
|
||||
import yaml
|
||||
import discord
|
||||
|
||||
from redbot.core import Config, commands, checks, bank
|
||||
from redbot.core import Config, commands, bank
|
||||
from redbot.core.bot import Red
|
||||
from redbot.core.data_manager import cog_data_path
|
||||
from redbot.core.i18n import Translator, cog_i18n
|
||||
@@ -77,7 +77,7 @@ class Trivia(commands.Cog):
|
||||
|
||||
@commands.group()
|
||||
@commands.guild_only()
|
||||
@checks.mod_or_permissions(administrator=True)
|
||||
@commands.mod_or_permissions(administrator=True)
|
||||
async def triviaset(self, ctx: commands.Context):
|
||||
"""Manage Trivia settings."""
|
||||
|
||||
@@ -194,7 +194,7 @@ class Trivia(commands.Cog):
|
||||
await ctx.send(_("Alright, I won't reveal the answer to the questions anymore."))
|
||||
|
||||
@bank.is_owner_if_bank_global()
|
||||
@checks.admin_or_permissions(manage_guild=True)
|
||||
@commands.admin_or_permissions(manage_guild=True)
|
||||
@triviaset.command(name="payout")
|
||||
async def triviaset_payout_multiplier(self, ctx: commands.Context, multiplier: finite_float):
|
||||
"""Set the payout multiplier.
|
||||
|
||||
@@ -2,7 +2,7 @@ from copy import copy
|
||||
import asyncio
|
||||
import discord
|
||||
|
||||
from redbot.core import Config, checks, commands
|
||||
from redbot.core import Config, commands
|
||||
from redbot.core.commands.requires import PrivilegeLevel
|
||||
from redbot.core.i18n import Translator
|
||||
from redbot.core.utils.predicates import MessagePredicate
|
||||
|
||||
@@ -3,7 +3,7 @@ import contextlib
|
||||
from datetime import timezone
|
||||
from collections import namedtuple
|
||||
from copy import copy
|
||||
from typing import Union, Optional, Literal
|
||||
from typing import Union, Literal
|
||||
|
||||
import discord
|
||||
|
||||
@@ -13,7 +13,7 @@ from redbot.cogs.warnings.helpers import (
|
||||
get_command_for_dropping_points,
|
||||
warning_points_remove_check,
|
||||
)
|
||||
from redbot.core import Config, checks, commands, modlog
|
||||
from redbot.core import Config, commands, modlog
|
||||
from redbot.core.bot import Red
|
||||
from redbot.core.commands import UserInputOptional
|
||||
from redbot.core.i18n import Translator, cog_i18n
|
||||
@@ -110,7 +110,7 @@ class Warnings(commands.Cog):
|
||||
|
||||
@commands.group()
|
||||
@commands.guild_only()
|
||||
@checks.guildowner_or_permissions(administrator=True)
|
||||
@commands.guildowner_or_permissions(administrator=True)
|
||||
async def warningset(self, ctx: commands.Context):
|
||||
"""Manage settings for Warnings."""
|
||||
pass
|
||||
@@ -195,7 +195,7 @@ class Warnings(commands.Cog):
|
||||
|
||||
@commands.group()
|
||||
@commands.guild_only()
|
||||
@checks.guildowner_or_permissions(administrator=True)
|
||||
@commands.guildowner_or_permissions(administrator=True)
|
||||
async def warnaction(self, ctx: commands.Context):
|
||||
"""Manage automated actions for Warnings.
|
||||
|
||||
@@ -261,7 +261,7 @@ class Warnings(commands.Cog):
|
||||
|
||||
@commands.group()
|
||||
@commands.guild_only()
|
||||
@checks.guildowner_or_permissions(administrator=True)
|
||||
@commands.guildowner_or_permissions(administrator=True)
|
||||
async def warnreason(self, ctx: commands.Context):
|
||||
"""Manage warning reasons.
|
||||
|
||||
@@ -305,7 +305,7 @@ class Warnings(commands.Cog):
|
||||
|
||||
@commands.command()
|
||||
@commands.guild_only()
|
||||
@checks.admin_or_permissions(ban_members=True)
|
||||
@commands.admin_or_permissions(ban_members=True)
|
||||
async def reasonlist(self, ctx: commands.Context):
|
||||
"""List all configured reasons for Warnings."""
|
||||
guild = ctx.guild
|
||||
@@ -334,7 +334,7 @@ class Warnings(commands.Cog):
|
||||
|
||||
@commands.command()
|
||||
@commands.guild_only()
|
||||
@checks.admin_or_permissions(ban_members=True)
|
||||
@commands.admin_or_permissions(ban_members=True)
|
||||
async def actionlist(self, ctx: commands.Context):
|
||||
"""List all configured automated actions for Warnings."""
|
||||
guild = ctx.guild
|
||||
@@ -369,7 +369,7 @@ class Warnings(commands.Cog):
|
||||
|
||||
@commands.command()
|
||||
@commands.guild_only()
|
||||
@checks.admin_or_permissions(ban_members=True)
|
||||
@commands.admin_or_permissions(ban_members=True)
|
||||
async def warn(
|
||||
self,
|
||||
ctx: commands.Context,
|
||||
@@ -525,7 +525,7 @@ class Warnings(commands.Cog):
|
||||
|
||||
@commands.command()
|
||||
@commands.guild_only()
|
||||
@checks.admin()
|
||||
@commands.admin()
|
||||
async def warnings(self, ctx: commands.Context, member: Union[discord.Member, int]):
|
||||
"""List the warnings for the specified user."""
|
||||
|
||||
@@ -601,7 +601,7 @@ class Warnings(commands.Cog):
|
||||
|
||||
@commands.command()
|
||||
@commands.guild_only()
|
||||
@checks.admin_or_permissions(ban_members=True)
|
||||
@commands.admin_or_permissions(ban_members=True)
|
||||
async def unwarn(
|
||||
self,
|
||||
ctx: commands.Context,
|
||||
|
||||
Reference in New Issue
Block a user