mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -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:
parent
a70f444255
commit
79d11e947c
@ -98,13 +98,13 @@ in various ways:
|
|||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@checks.admin_or_permissions(manage_guild=True)
|
@commands.admin_or_permissions(manage_guild=True)
|
||||||
async def setbaz(self, ctx, new_value):
|
async def setbaz(self, ctx, new_value):
|
||||||
await self.config.guild(ctx.guild).baz.set(new_value)
|
await self.config.guild(ctx.guild).baz.set(new_value)
|
||||||
await ctx.send("Value of baz has been changed!")
|
await ctx.send("Value of baz has been changed!")
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def setfoobar(self, ctx, new_value):
|
async def setfoobar(self, ctx, new_value):
|
||||||
await self.config.foobar.set(new_value)
|
await self.config.foobar.set(new_value)
|
||||||
|
|
||||||
@ -259,7 +259,7 @@ Now let's see an example that uses multiple identifiers:
|
|||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from redbot.core import Config, commands, checks
|
from redbot.core import Config, commands
|
||||||
|
|
||||||
|
|
||||||
class ChannelAccess(commands.Cog):
|
class ChannelAccess(commands.Cog):
|
||||||
@ -273,7 +273,7 @@ Now let's see an example that uses multiple identifiers:
|
|||||||
self.config.register_custom("ChannelAccess", **default_access)
|
self.config.register_custom("ChannelAccess", **default_access)
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def grantaccess(self, ctx, channel: discord.TextChannel, member: discord.Member):
|
async def grantaccess(self, ctx, channel: discord.TextChannel, member: discord.Member):
|
||||||
await self.config.custom("ChannelAccess", channel.id, member.id).allowed.set(True)
|
await self.config.custom("ChannelAccess", channel.id, member.id).allowed.set(True)
|
||||||
await ctx.send("Member has been granted access to that channel")
|
await ctx.send("Member has been granted access to that channel")
|
||||||
|
|||||||
@ -21,7 +21,7 @@ Basic Usage
|
|||||||
|
|
||||||
class MyCog(commands.Cog):
|
class MyCog(commands.Cog):
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@checks.admin_or_permissions(ban_members=True)
|
@commands.admin_or_permissions(ban_members=True)
|
||||||
async def ban(self, ctx, user: discord.Member, reason: str = None):
|
async def ban(self, ctx, user: discord.Member, reason: str = None):
|
||||||
await ctx.guild.ban(user)
|
await ctx.guild.ban(user)
|
||||||
case = await modlog.create_case(
|
case = await modlog.create_case(
|
||||||
|
|||||||
@ -73,7 +73,7 @@ Any Cog Creator that does not follow these requirements will have their repo rem
|
|||||||
|
|
||||||
- Cogs that are more than what is able to be run in a simple eval.
|
- Cogs that are more than what is able to be run in a simple eval.
|
||||||
- Cogs that are more than just a simple API access request.
|
- Cogs that are more than just a simple API access request.
|
||||||
- Cogs that properly use Red utilities, including Config, checks, and any other utility functions.
|
- Cogs that properly use Red utilities, for example Config, or any other utility functions.
|
||||||
- Cogs that use event listeners (bot.wait_for or cog-wide listeners) or custom tasks that are efficient and handle exceptions appropriately.
|
- Cogs that use event listeners (bot.wait_for or cog-wide listeners) or custom tasks that are efficient and handle exceptions appropriately.
|
||||||
- Cogs that handle errors properly.
|
- Cogs that handle errors properly.
|
||||||
- Cogs that handle permissions properly.
|
- Cogs that handle permissions properly.
|
||||||
@ -84,7 +84,7 @@ Any Cog Creator that does not follow these requirements will have their repo rem
|
|||||||
- The default locale must be English.
|
- The default locale must be English.
|
||||||
- The main cog class and every command must have a doc-string.
|
- The main cog class and every command must have a doc-string.
|
||||||
- No cog allows for escalation of permissions. (e.g., sending a mass ping through the bot without having permission to do so)
|
- No cog allows for escalation of permissions. (e.g., sending a mass ping through the bot without having permission to do so)
|
||||||
- Respect the role hierarchy. Don’t let a lower role have a way to grant a higher role.
|
- Respect the role hierarchy. Don't let a lower role have a way to grant a higher role.
|
||||||
- If your cog install comes with any pre-packaged data, use `bundled_data_path()` to access it.
|
- If your cog install comes with any pre-packaged data, use `bundled_data_path()` to access it.
|
||||||
- If your cog install creates any non-config data, use `cog_data_path()` to store it.
|
- If your cog install creates any non-config data, use `cog_data_path()` to store it.
|
||||||
- Unless the cog is intentionally designed to listen to certain input from bots, cogs should ignore input from bots.
|
- Unless the cog is intentionally designed to listen to certain input from bots, cogs should ignore input from bots.
|
||||||
@ -138,7 +138,8 @@ While not required for approved Cog Creators, they are still recommended in orde
|
|||||||
- ``ctx.embed_color``
|
- ``ctx.embed_color``
|
||||||
- ``bot.is_automod_immune``
|
- ``bot.is_automod_immune``
|
||||||
|
|
||||||
- Use checks to limit command use when the bot needs special permissions.
|
- Use decorators to limit command use, restrict usage, or define whether the bot needs special permissions.
|
||||||
|
You can find all of the permission and cooldown related decorators under the ``redbot.core.commands`` namespace.
|
||||||
- Check against user input before doing things. Common things to check:
|
- Check against user input before doing things. Common things to check:
|
||||||
|
|
||||||
- Resulting output is safe.
|
- Resulting output is safe.
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import logging
|
|||||||
from typing import Tuple, Union
|
from typing import Tuple, Union
|
||||||
|
|
||||||
import discord
|
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.i18n import Translator, cog_i18n
|
||||||
from redbot.core.utils.chat_formatting import box
|
from redbot.core.utils.chat_formatting import box
|
||||||
from redbot.core.utils.mod import get_audit_reason
|
from redbot.core.utils.mod import get_audit_reason
|
||||||
@ -215,7 +215,7 @@ class Admin(commands.Cog):
|
|||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.admin_or_permissions(manage_roles=True)
|
@commands.admin_or_permissions(manage_roles=True)
|
||||||
async def addrole(
|
async def addrole(
|
||||||
self,
|
self,
|
||||||
ctx: commands.Context,
|
ctx: commands.Context,
|
||||||
@ -233,7 +233,7 @@ class Admin(commands.Cog):
|
|||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.admin_or_permissions(manage_roles=True)
|
@commands.admin_or_permissions(manage_roles=True)
|
||||||
async def removerole(
|
async def removerole(
|
||||||
self,
|
self,
|
||||||
ctx: commands.Context,
|
ctx: commands.Context,
|
||||||
@ -251,7 +251,7 @@ class Admin(commands.Cog):
|
|||||||
|
|
||||||
@commands.group()
|
@commands.group()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.admin_or_permissions(manage_roles=True)
|
@commands.admin_or_permissions(manage_roles=True)
|
||||||
async def editrole(self, ctx: commands.Context):
|
async def editrole(self, ctx: commands.Context):
|
||||||
"""Edit role settings."""
|
"""Edit role settings."""
|
||||||
pass
|
pass
|
||||||
@ -325,7 +325,7 @@ class Admin(commands.Cog):
|
|||||||
await ctx.send(_("Done."))
|
await ctx.send(_("Done."))
|
||||||
|
|
||||||
@commands.group(invoke_without_command=True)
|
@commands.group(invoke_without_command=True)
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def announce(self, ctx: commands.Context, *, message: str):
|
async def announce(self, ctx: commands.Context, *, message: str):
|
||||||
"""Announce a message to all servers the bot is in."""
|
"""Announce a message to all servers the bot is in."""
|
||||||
if not self.is_announcing():
|
if not self.is_announcing():
|
||||||
@ -350,7 +350,7 @@ class Admin(commands.Cog):
|
|||||||
|
|
||||||
@commands.group()
|
@commands.group()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.guildowner_or_permissions(administrator=True)
|
@commands.guildowner_or_permissions(administrator=True)
|
||||||
async def announceset(self, ctx):
|
async def announceset(self, ctx):
|
||||||
"""Change how announcements are sent in this guild."""
|
"""Change how announcements are sent in this guild."""
|
||||||
pass
|
pass
|
||||||
@ -441,7 +441,7 @@ class Admin(commands.Cog):
|
|||||||
await ctx.send(box(msg, "diff"))
|
await ctx.send(box(msg, "diff"))
|
||||||
|
|
||||||
@commands.group()
|
@commands.group()
|
||||||
@checks.admin_or_permissions(manage_roles=True)
|
@commands.admin_or_permissions(manage_roles=True)
|
||||||
async def selfroleset(self, ctx: commands.Context):
|
async def selfroleset(self, ctx: commands.Context):
|
||||||
"""Manage selfroles."""
|
"""Manage selfroles."""
|
||||||
pass
|
pass
|
||||||
@ -541,7 +541,7 @@ class Admin(commands.Cog):
|
|||||||
await ctx.send(_("No changes have been made."))
|
await ctx.send(_("No changes have been made."))
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def serverlock(self, ctx: commands.Context):
|
async def serverlock(self, ctx: commands.Context):
|
||||||
"""Lock a bot to its current servers only."""
|
"""Lock a bot to its current servers only."""
|
||||||
serverlocked = await self.config.serverlocked()
|
serverlocked = await self.config.serverlocked()
|
||||||
|
|||||||
@ -3,10 +3,10 @@ import logging
|
|||||||
from copy import copy
|
from copy import copy
|
||||||
from re import search
|
from re import search
|
||||||
from string import Formatter
|
from string import Formatter
|
||||||
from typing import Dict, List, Literal
|
from typing import List, Literal
|
||||||
|
|
||||||
import discord
|
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.i18n import Translator, cog_i18n
|
||||||
from redbot.core.utils.chat_formatting import box, pagify
|
from redbot.core.utils.chat_formatting import box, pagify
|
||||||
from redbot.core.utils.menus import menu
|
from redbot.core.utils.menus import menu
|
||||||
@ -197,7 +197,7 @@ class Alias(commands.Cog):
|
|||||||
"""Manage global aliases."""
|
"""Manage global aliases."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@checks.mod_or_permissions(manage_guild=True)
|
@commands.mod_or_permissions(manage_guild=True)
|
||||||
@alias.command(name="add")
|
@alias.command(name="add")
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def _add_alias(self, ctx: commands.Context, alias_name: str, *, command):
|
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)
|
_("A new alias with the trigger `{name}` has been created.").format(name=alias_name)
|
||||||
)
|
)
|
||||||
|
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
@global_.command(name="add")
|
@global_.command(name="add")
|
||||||
async def _add_global_alias(self, ctx: commands.Context, alias_name: str, *, command):
|
async def _add_global_alias(self, ctx: commands.Context, alias_name: str, *, command):
|
||||||
"""Add a global alias for a 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")
|
@alias.command(name="edit")
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def _edit_alias(self, ctx: commands.Context, alias_name: str, *, command):
|
async def _edit_alias(self, ctx: commands.Context, alias_name: str, *, command):
|
||||||
@ -351,7 +351,7 @@ class Alias(commands.Cog):
|
|||||||
except ArgParseError as e:
|
except ArgParseError as e:
|
||||||
return await ctx.send(" ".join(e.args))
|
return await ctx.send(" ".join(e.args))
|
||||||
|
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
@global_.command(name="edit")
|
@global_.command(name="edit")
|
||||||
async def _edit_global_alias(self, ctx: commands.Context, alias_name: str, *, command):
|
async def _edit_global_alias(self, ctx: commands.Context, alias_name: str, *, command):
|
||||||
"""Edit an existing global alias."""
|
"""Edit an existing global alias."""
|
||||||
@ -407,7 +407,7 @@ class Alias(commands.Cog):
|
|||||||
else:
|
else:
|
||||||
await ctx.send(_("There is no alias with the name `{name}`").format(name=alias_name))
|
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"])
|
@alias.command(name="delete", aliases=["del", "remove"])
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def _del_alias(self, ctx: commands.Context, alias_name: str):
|
async def _del_alias(self, ctx: commands.Context, alias_name: str):
|
||||||
@ -423,7 +423,7 @@ class Alias(commands.Cog):
|
|||||||
else:
|
else:
|
||||||
await ctx.send(_("Alias with name `{name}` was not found.").format(name=alias_name))
|
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"])
|
@global_.command(name="delete", aliases=["del", "remove"])
|
||||||
async def _del_global_alias(self, ctx: commands.Context, alias_name: str):
|
async def _del_global_alias(self, ctx: commands.Context, alias_name: str):
|
||||||
"""Delete an existing global alias."""
|
"""Delete an existing global alias."""
|
||||||
|
|||||||
@ -5,7 +5,7 @@ from typing import Callable, List, Optional, Set, Union
|
|||||||
|
|
||||||
import discord
|
import discord
|
||||||
|
|
||||||
from redbot.core import checks, commands, Config
|
from redbot.core import commands, Config
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
from redbot.core.commands import RawUserIdConverter
|
from redbot.core.commands import RawUserIdConverter
|
||||||
from redbot.core.i18n import Translator, cog_i18n
|
from redbot.core.i18n import Translator, cog_i18n
|
||||||
@ -176,7 +176,7 @@ class Cleanup(commands.Cog):
|
|||||||
|
|
||||||
@cleanup.command()
|
@cleanup.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.mod_or_permissions(manage_messages=True)
|
@commands.mod_or_permissions(manage_messages=True)
|
||||||
@commands.bot_has_permissions(manage_messages=True)
|
@commands.bot_has_permissions(manage_messages=True)
|
||||||
async def text(
|
async def text(
|
||||||
self, ctx: commands.Context, text: str, number: positive_int, delete_pinned: bool = False
|
self, ctx: commands.Context, text: str, number: positive_int, delete_pinned: bool = False
|
||||||
@ -232,7 +232,7 @@ class Cleanup(commands.Cog):
|
|||||||
|
|
||||||
@cleanup.command()
|
@cleanup.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.mod_or_permissions(manage_messages=True)
|
@commands.mod_or_permissions(manage_messages=True)
|
||||||
@commands.bot_has_permissions(manage_messages=True)
|
@commands.bot_has_permissions(manage_messages=True)
|
||||||
async def user(
|
async def user(
|
||||||
self,
|
self,
|
||||||
@ -303,7 +303,7 @@ class Cleanup(commands.Cog):
|
|||||||
|
|
||||||
@cleanup.command()
|
@cleanup.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.mod_or_permissions(manage_messages=True)
|
@commands.mod_or_permissions(manage_messages=True)
|
||||||
@commands.bot_has_permissions(manage_messages=True)
|
@commands.bot_has_permissions(manage_messages=True)
|
||||||
async def after(
|
async def after(
|
||||||
self,
|
self,
|
||||||
@ -356,7 +356,7 @@ class Cleanup(commands.Cog):
|
|||||||
|
|
||||||
@cleanup.command()
|
@cleanup.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.mod_or_permissions(manage_messages=True)
|
@commands.mod_or_permissions(manage_messages=True)
|
||||||
@commands.bot_has_permissions(manage_messages=True)
|
@commands.bot_has_permissions(manage_messages=True)
|
||||||
async def before(
|
async def before(
|
||||||
self,
|
self,
|
||||||
@ -412,7 +412,7 @@ class Cleanup(commands.Cog):
|
|||||||
|
|
||||||
@cleanup.command()
|
@cleanup.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.mod_or_permissions(manage_messages=True)
|
@commands.mod_or_permissions(manage_messages=True)
|
||||||
@commands.bot_has_permissions(manage_messages=True)
|
@commands.bot_has_permissions(manage_messages=True)
|
||||||
async def between(
|
async def between(
|
||||||
self,
|
self,
|
||||||
@ -465,7 +465,7 @@ class Cleanup(commands.Cog):
|
|||||||
|
|
||||||
@cleanup.command()
|
@cleanup.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.mod_or_permissions(manage_messages=True)
|
@commands.mod_or_permissions(manage_messages=True)
|
||||||
@commands.bot_has_permissions(manage_messages=True)
|
@commands.bot_has_permissions(manage_messages=True)
|
||||||
async def messages(
|
async def messages(
|
||||||
self, ctx: commands.Context, number: positive_int, delete_pinned: bool = False
|
self, ctx: commands.Context, number: positive_int, delete_pinned: bool = False
|
||||||
@ -504,7 +504,7 @@ class Cleanup(commands.Cog):
|
|||||||
|
|
||||||
@cleanup.command(name="bot")
|
@cleanup.command(name="bot")
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.mod_or_permissions(manage_messages=True)
|
@commands.mod_or_permissions(manage_messages=True)
|
||||||
@commands.bot_has_permissions(manage_messages=True)
|
@commands.bot_has_permissions(manage_messages=True)
|
||||||
async def cleanup_bot(
|
async def cleanup_bot(
|
||||||
self, ctx: commands.Context, number: positive_int, delete_pinned: bool = False
|
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"])
|
@cleanup.command(name="duplicates", aliases=["spam"])
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.mod_or_permissions(manage_messages=True)
|
@commands.mod_or_permissions(manage_messages=True)
|
||||||
@commands.bot_has_permissions(manage_messages=True)
|
@commands.bot_has_permissions(manage_messages=True)
|
||||||
async def cleanup_duplicates(
|
async def cleanup_duplicates(
|
||||||
self, ctx: commands.Context, number: positive_int = PositiveInt(50)
|
self, ctx: commands.Context, number: positive_int = PositiveInt(50)
|
||||||
|
|||||||
@ -9,7 +9,7 @@ from urllib.parse import quote_plus
|
|||||||
import discord
|
import discord
|
||||||
from rapidfuzz import process
|
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.i18n import Translator, cog_i18n
|
||||||
from redbot.core.utils import menus, AsyncIter
|
from redbot.core.utils import menus, AsyncIter
|
||||||
from redbot.core.utils.chat_formatting import box, pagify, escape, humanize_list
|
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))
|
await ctx.send(_("The following matches have been found:") + box(content))
|
||||||
|
|
||||||
@customcom.group(name="create", aliases=["add"], invoke_without_command=True)
|
@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):
|
async def cc_create(self, ctx: commands.Context, command: str.lower, *, text: str):
|
||||||
"""Create custom commands.
|
"""Create custom commands.
|
||||||
|
|
||||||
@ -358,7 +358,7 @@ class CustomCommands(commands.Cog):
|
|||||||
await ctx.invoke(self.cc_create_simple, command=command, text=text)
|
await ctx.invoke(self.cc_create_simple, command=command, text=text)
|
||||||
|
|
||||||
@cc_create.command(name="random")
|
@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):
|
async def cc_create_random(self, ctx: commands.Context, command: str.lower):
|
||||||
"""Create a CC where it will randomly choose a response!
|
"""Create a CC where it will randomly choose a response!
|
||||||
|
|
||||||
@ -397,7 +397,7 @@ class CustomCommands(commands.Cog):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@cc_create.command(name="simple")
|
@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):
|
async def cc_create_simple(self, ctx, command: str.lower, *, text: str):
|
||||||
"""Add a simple custom command.
|
"""Add a simple custom command.
|
||||||
|
|
||||||
@ -436,7 +436,7 @@ class CustomCommands(commands.Cog):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@customcom.command(name="cooldown")
|
@customcom.command(name="cooldown")
|
||||||
@checks.mod_or_permissions(administrator=True)
|
@commands.mod_or_permissions(administrator=True)
|
||||||
async def cc_cooldown(
|
async def cc_cooldown(
|
||||||
self, ctx, command: str.lower, cooldown: int = None, *, per: str.lower = "member"
|
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"])
|
@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):
|
async def cc_delete(self, ctx, command: str.lower):
|
||||||
"""Delete a custom command.
|
"""Delete a custom command.
|
||||||
|
|
||||||
@ -505,7 +505,7 @@ class CustomCommands(commands.Cog):
|
|||||||
await ctx.send(_("That command doesn't exist."))
|
await ctx.send(_("That command doesn't exist."))
|
||||||
|
|
||||||
@customcom.command(name="edit")
|
@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):
|
async def cc_edit(self, ctx, command: str.lower, *, text: str = None):
|
||||||
"""Edit a custom command.
|
"""Edit a custom command.
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@ from typing import Tuple, Union, Iterable, Collection, Optional, Dict, Set, List
|
|||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
import discord
|
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.bot import Red
|
||||||
from redbot.core.data_manager import cog_data_path
|
from redbot.core.data_manager import cog_data_path
|
||||||
from redbot.core.i18n import Translator, cog_i18n
|
from redbot.core.i18n import Translator, cog_i18n
|
||||||
@ -480,7 +480,7 @@ class Downloader(commands.Cog):
|
|||||||
await target.send(page)
|
await target.send(page)
|
||||||
|
|
||||||
@commands.command(require_var_positional=True)
|
@commands.command(require_var_positional=True)
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def pipinstall(self, ctx: commands.Context, *deps: str) -> None:
|
async def pipinstall(self, ctx: commands.Context, *deps: str) -> None:
|
||||||
"""
|
"""
|
||||||
Install a group of dependencies using pip.
|
Install a group of dependencies using pip.
|
||||||
@ -514,7 +514,7 @@ class Downloader(commands.Cog):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@commands.group()
|
@commands.group()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def repo(self, ctx: commands.Context) -> None:
|
async def repo(self, ctx: commands.Context) -> None:
|
||||||
"""Base command for repository management."""
|
"""Base command for repository management."""
|
||||||
pass
|
pass
|
||||||
@ -698,7 +698,7 @@ class Downloader(commands.Cog):
|
|||||||
await self.send_pagified(ctx, message)
|
await self.send_pagified(ctx, message)
|
||||||
|
|
||||||
@commands.group()
|
@commands.group()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def cog(self, ctx: commands.Context) -> None:
|
async def cog(self, ctx: commands.Context) -> None:
|
||||||
"""Base command for cog installation management commands."""
|
"""Base command for cog installation management commands."""
|
||||||
pass
|
pass
|
||||||
|
|||||||
@ -9,7 +9,7 @@ from typing import cast, Iterable, Union, Literal
|
|||||||
|
|
||||||
import discord
|
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.commands.converter import TimedeltaConverter
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
from redbot.core.i18n import Translator, cog_i18n
|
from redbot.core.i18n import Translator, cog_i18n
|
||||||
@ -237,7 +237,7 @@ class Economy(commands.Cog):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@bank.is_owner_if_bank_global()
|
@bank.is_owner_if_bank_global()
|
||||||
@checks.admin_or_permissions(manage_guild=True)
|
@commands.admin_or_permissions(manage_guild=True)
|
||||||
@_bank.command(name="set")
|
@_bank.command(name="set")
|
||||||
async def _set(self, ctx: commands.Context, to: discord.Member, creds: SetParser):
|
async def _set(self, ctx: commands.Context, to: discord.Member, creds: SetParser):
|
||||||
"""Set the balance of a user's bank account.
|
"""Set the balance of a user's bank account.
|
||||||
@ -656,7 +656,7 @@ class Economy(commands.Cog):
|
|||||||
|
|
||||||
@guild_only_check()
|
@guild_only_check()
|
||||||
@bank.is_owner_if_bank_global()
|
@bank.is_owner_if_bank_global()
|
||||||
@checks.admin_or_permissions(manage_guild=True)
|
@commands.admin_or_permissions(manage_guild=True)
|
||||||
@commands.group()
|
@commands.group()
|
||||||
async def economyset(self, ctx: commands.Context):
|
async def economyset(self, ctx: commands.Context):
|
||||||
"""Base command to manage Economy settings."""
|
"""Base command to manage Economy settings."""
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import re
|
|||||||
from datetime import timezone
|
from datetime import timezone
|
||||||
from typing import Union, Set, Literal, Optional
|
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.bot import Red
|
||||||
from redbot.core.i18n import Translator, cog_i18n, set_contextual_locales_from_guild
|
from redbot.core.i18n import Translator, cog_i18n, set_contextual_locales_from_guild
|
||||||
from redbot.core.utils.predicates import MessagePredicate
|
from redbot.core.utils.predicates import MessagePredicate
|
||||||
@ -80,7 +80,7 @@ class Filter(commands.Cog):
|
|||||||
|
|
||||||
@commands.group()
|
@commands.group()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.admin_or_permissions(manage_guild=True)
|
@commands.admin_or_permissions(manage_guild=True)
|
||||||
async def filterset(self, ctx: commands.Context):
|
async def filterset(self, ctx: commands.Context):
|
||||||
"""Base command to manage filter settings."""
|
"""Base command to manage filter settings."""
|
||||||
pass
|
pass
|
||||||
@ -144,7 +144,7 @@ class Filter(commands.Cog):
|
|||||||
|
|
||||||
@commands.group(name="filter")
|
@commands.group(name="filter")
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.mod_or_permissions(manage_messages=True)
|
@commands.mod_or_permissions(manage_messages=True)
|
||||||
async def _filter(self, ctx: commands.Context):
|
async def _filter(self, ctx: commands.Context):
|
||||||
"""Base command to add or remove words from the server filter.
|
"""Base command to add or remove words from the server filter.
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@ from typing import Optional
|
|||||||
import aiohttp
|
import aiohttp
|
||||||
|
|
||||||
from redbot.core.i18n import Translator, cog_i18n
|
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
|
from redbot.core.commands import UserInputOptional
|
||||||
|
|
||||||
_ = Translator("Image", __file__)
|
_ = Translator("Image", __file__)
|
||||||
@ -153,7 +153,7 @@ class Image(commands.Cog):
|
|||||||
_("Something went wrong. Error code is {code}.").format(code=data["status"])
|
_("Something went wrong. Error code is {code}.").format(code=data["status"])
|
||||||
)
|
)
|
||||||
|
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
@commands.command()
|
@commands.command()
|
||||||
async def imgurcreds(self, ctx):
|
async def imgurcreds(self, ctx):
|
||||||
"""Explain how to set imgur API tokens."""
|
"""Explain how to set imgur API tokens."""
|
||||||
@ -228,7 +228,7 @@ class Image(commands.Cog):
|
|||||||
else:
|
else:
|
||||||
await ctx.send(_("Error contacting the API."))
|
await ctx.send(_("Error contacting the API."))
|
||||||
|
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
@commands.command()
|
@commands.command()
|
||||||
async def giphycreds(self, ctx):
|
async def giphycreds(self, ctx):
|
||||||
"""Explains how to set GIPHY API tokens."""
|
"""Explains how to set GIPHY API tokens."""
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from typing import List, Tuple, Optional
|
from typing import Optional
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
from redbot.core import Config, commands
|
from redbot.core import Config, commands
|
||||||
|
|||||||
@ -5,8 +5,8 @@ from datetime import datetime, timedelta, timezone
|
|||||||
from typing import Dict, List, Optional, Tuple, Union
|
from typing import Dict, List, Optional, Tuple, Union
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
from redbot.core import commands, i18n, checks, modlog
|
from redbot.core import commands, i18n, modlog
|
||||||
from redbot.core.commands import UserInputOptional, RawUserIdConverter
|
from redbot.core.commands import RawUserIdConverter
|
||||||
from redbot.core.utils import AsyncIter
|
from redbot.core.utils import AsyncIter
|
||||||
from redbot.core.utils.chat_formatting import (
|
from redbot.core.utils.chat_formatting import (
|
||||||
pagify,
|
pagify,
|
||||||
@ -281,7 +281,7 @@ class KickBanMixin(MixinMeta):
|
|||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@commands.bot_has_permissions(kick_members=True)
|
@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):
|
async def kick(self, ctx: commands.Context, member: discord.Member, *, reason: str = None):
|
||||||
"""
|
"""
|
||||||
Kick a user.
|
Kick a user.
|
||||||
@ -359,7 +359,7 @@ class KickBanMixin(MixinMeta):
|
|||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@commands.bot_has_permissions(ban_members=True)
|
@commands.bot_has_permissions(ban_members=True)
|
||||||
@checks.admin_or_permissions(ban_members=True)
|
@commands.admin_or_permissions(ban_members=True)
|
||||||
async def ban(
|
async def ban(
|
||||||
self,
|
self,
|
||||||
ctx: commands.Context,
|
ctx: commands.Context,
|
||||||
@ -397,7 +397,7 @@ class KickBanMixin(MixinMeta):
|
|||||||
@commands.command(aliases=["hackban"], usage="<user_ids...> [days] [reason]")
|
@commands.command(aliases=["hackban"], usage="<user_ids...> [days] [reason]")
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@commands.bot_has_permissions(ban_members=True)
|
@commands.bot_has_permissions(ban_members=True)
|
||||||
@checks.admin_or_permissions(ban_members=True)
|
@commands.admin_or_permissions(ban_members=True)
|
||||||
async def massban(
|
async def massban(
|
||||||
self,
|
self,
|
||||||
ctx: commands.Context,
|
ctx: commands.Context,
|
||||||
@ -571,7 +571,7 @@ class KickBanMixin(MixinMeta):
|
|||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@commands.bot_has_permissions(ban_members=True)
|
@commands.bot_has_permissions(ban_members=True)
|
||||||
@checks.admin_or_permissions(ban_members=True)
|
@commands.admin_or_permissions(ban_members=True)
|
||||||
async def tempban(
|
async def tempban(
|
||||||
self,
|
self,
|
||||||
ctx: commands.Context,
|
ctx: commands.Context,
|
||||||
@ -670,7 +670,7 @@ class KickBanMixin(MixinMeta):
|
|||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@commands.bot_has_permissions(ban_members=True)
|
@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):
|
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."""
|
"""Kick a user and delete 1 day's worth of their messages."""
|
||||||
guild = ctx.guild
|
guild = ctx.guild
|
||||||
@ -797,7 +797,7 @@ class KickBanMixin(MixinMeta):
|
|||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.guild_only()
|
@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(
|
async def voiceunban(
|
||||||
self, ctx: commands.Context, member: discord.Member, *, reason: str = None
|
self, ctx: commands.Context, member: discord.Member, *, reason: str = None
|
||||||
):
|
):
|
||||||
@ -840,7 +840,7 @@ class KickBanMixin(MixinMeta):
|
|||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.guild_only()
|
@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):
|
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."""
|
"""Ban a user from speaking and listening in the server's voice channels."""
|
||||||
user_voice_state: discord.VoiceState = member.voice
|
user_voice_state: discord.VoiceState = member.voice
|
||||||
@ -882,7 +882,7 @@ class KickBanMixin(MixinMeta):
|
|||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@commands.bot_has_permissions(ban_members=True)
|
@commands.bot_has_permissions(ban_members=True)
|
||||||
@checks.admin_or_permissions(ban_members=True)
|
@commands.admin_or_permissions(ban_members=True)
|
||||||
async def unban(
|
async def unban(
|
||||||
self, ctx: commands.Context, user_id: RawUserIdConverter, *, reason: str = None
|
self, ctx: commands.Context, user_id: RawUserIdConverter, *, reason: str = None
|
||||||
):
|
):
|
||||||
|
|||||||
@ -3,14 +3,12 @@ import logging
|
|||||||
import re
|
import re
|
||||||
from abc import ABC
|
from abc import ABC
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from typing import List, Tuple, Literal
|
from typing import Literal
|
||||||
|
|
||||||
import discord
|
from redbot.core import Config, commands
|
||||||
from redbot.core.utils import AsyncIter
|
|
||||||
|
|
||||||
from redbot.core import Config, modlog, commands
|
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
from redbot.core.i18n import Translator, cog_i18n
|
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._internal_utils import send_to_owners_with_prefix_replaced
|
||||||
from redbot.core.utils.chat_formatting import inline
|
from redbot.core.utils.chat_formatting import inline
|
||||||
from .events import Events
|
from .events import Events
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import datetime
|
|||||||
from typing import cast
|
from typing import cast
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
from redbot.core import commands, i18n, checks
|
from redbot.core import commands, i18n
|
||||||
from redbot.core.utils.common_filters import (
|
from redbot.core.utils.common_filters import (
|
||||||
filter_invites,
|
filter_invites,
|
||||||
filter_various_mentions,
|
filter_various_mentions,
|
||||||
@ -32,7 +32,7 @@ class ModInfo(MixinMeta):
|
|||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@commands.bot_has_permissions(manage_nicknames=True)
|
@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 = ""):
|
async def rename(self, ctx: commands.Context, member: discord.Member, *, nickname: str = ""):
|
||||||
"""Change a member's nickname.
|
"""Change a member's nickname.
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
from collections import defaultdict, deque
|
from collections import defaultdict, deque
|
||||||
from typing import Optional
|
|
||||||
from datetime import timedelta
|
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 import AsyncIter
|
||||||
from redbot.core.utils.chat_formatting import box, humanize_timedelta, inline
|
from redbot.core.utils.chat_formatting import box, humanize_timedelta, inline
|
||||||
|
|
||||||
@ -18,7 +17,7 @@ class ModSettings(MixinMeta):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
@commands.group()
|
@commands.group()
|
||||||
@checks.guildowner_or_permissions(administrator=True)
|
@commands.guildowner_or_permissions(administrator=True)
|
||||||
async def modset(self, ctx: commands.Context):
|
async def modset(self, ctx: commands.Context):
|
||||||
"""Manage server administration settings."""
|
"""Manage server administration settings."""
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import discord
|
|||||||
import re
|
import re
|
||||||
from .abc import MixinMeta
|
from .abc import MixinMeta
|
||||||
from datetime import timedelta
|
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
|
from redbot.core.utils.chat_formatting import humanize_timedelta
|
||||||
|
|
||||||
_ = i18n.Translator("Mod", __file__)
|
_ = i18n.Translator("Mod", __file__)
|
||||||
|
|||||||
@ -1,11 +1,10 @@
|
|||||||
import asyncio
|
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
|
|
||||||
from typing import Optional, Union
|
from typing import Optional, Union
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
|
|
||||||
from redbot.core import checks, commands, modlog
|
from redbot.core import commands, modlog
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
from redbot.core.i18n import Translator, cog_i18n
|
from redbot.core.i18n import Translator, cog_i18n
|
||||||
from redbot.core.utils.chat_formatting import bold, box, pagify
|
from redbot.core.utils.chat_formatting import bold, box, pagify
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from typing import List, Tuple, Optional, Dict, Union
|
from typing import Optional, Dict, Union
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
|
|||||||
@ -11,7 +11,7 @@ from .converters import MuteTime
|
|||||||
from .voicemutes import VoiceMutes
|
from .voicemutes import VoiceMutes
|
||||||
|
|
||||||
from redbot.core.bot import Red
|
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 import AsyncIter, bounded_gather, can_user_react_in
|
||||||
from redbot.core.utils.chat_formatting import (
|
from redbot.core.utils.chat_formatting import (
|
||||||
bold,
|
bold,
|
||||||
@ -789,7 +789,7 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
|
|||||||
|
|
||||||
@muteset.command()
|
@muteset.command()
|
||||||
@commands.guild_only()
|
@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):
|
async def senddm(self, ctx: commands.Context, true_or_false: bool):
|
||||||
"""Set whether mute notifications should be sent to users in DMs."""
|
"""Set whether mute notifications should be sent to users in DMs."""
|
||||||
await self.config.guild(ctx.guild).dm.set(true_or_false)
|
await self.config.guild(ctx.guild).dm.set(true_or_false)
|
||||||
@ -800,7 +800,7 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
|
|||||||
|
|
||||||
@muteset.command()
|
@muteset.command()
|
||||||
@commands.guild_only()
|
@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):
|
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."""
|
"""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)
|
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."))
|
await ctx.send(_("Okay I will allow channel overwrites for muting users."))
|
||||||
|
|
||||||
@muteset.command(name="settings", aliases=["showsettings"])
|
@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):
|
async def show_mutes_settings(self, ctx: commands.Context):
|
||||||
"""
|
"""
|
||||||
Shows the current mute settings for this guild.
|
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)
|
await ctx.maybe_send_embed(msg)
|
||||||
|
|
||||||
@muteset.command(name="notification")
|
@muteset.command(name="notification")
|
||||||
@checks.admin_or_permissions(manage_channels=True)
|
@commands.admin_or_permissions(manage_channels=True)
|
||||||
async def notification_channel_set(
|
async def notification_channel_set(
|
||||||
self,
|
self,
|
||||||
ctx: commands.Context,
|
ctx: commands.Context,
|
||||||
@ -878,7 +878,7 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@muteset.command(name="role")
|
@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)
|
@commands.bot_has_guild_permissions(manage_roles=True)
|
||||||
async def mute_role(self, ctx: commands.Context, *, role: discord.Role = None):
|
async def mute_role(self, ctx: commands.Context, *, role: discord.Role = None):
|
||||||
"""Sets the role to be applied when muting a user.
|
"""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")
|
@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.bot_has_guild_permissions(manage_roles=True)
|
||||||
@commands.max_concurrency(1, commands.BucketType.guild)
|
@commands.max_concurrency(1, commands.BucketType.guild)
|
||||||
async def make_mute_role(self, ctx: commands.Context, *, name: str):
|
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
|
return channel.mention
|
||||||
|
|
||||||
@muteset.command(name="defaulttime", aliases=["time"])
|
@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):
|
async def default_mute_time(self, ctx: commands.Context, *, time: Optional[MuteTime] = None):
|
||||||
"""
|
"""
|
||||||
Set the default mute time for the mute command.
|
Set the default mute time for the mute command.
|
||||||
@ -1107,7 +1107,7 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
|
|||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.mod_or_permissions(manage_roles=True)
|
@commands.mod_or_permissions(manage_roles=True)
|
||||||
async def activemutes(self, ctx: commands.Context):
|
async def activemutes(self, ctx: commands.Context):
|
||||||
"""
|
"""
|
||||||
Displays active mutes on this server.
|
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.command(usage="<users...> [time_and_reason]")
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.mod_or_permissions(manage_roles=True)
|
@commands.mod_or_permissions(manage_roles=True)
|
||||||
async def mute(
|
async def mute(
|
||||||
self,
|
self,
|
||||||
ctx: commands.Context,
|
ctx: commands.Context,
|
||||||
@ -1321,7 +1321,7 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
|
|||||||
@commands.command(
|
@commands.command(
|
||||||
name="mutechannel", aliases=["channelmute"], usage="<users...> [time_and_reason]"
|
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)
|
@commands.bot_has_guild_permissions(manage_permissions=True)
|
||||||
async def channel_mute(
|
async def channel_mute(
|
||||||
self,
|
self,
|
||||||
@ -1411,7 +1411,7 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
|
|||||||
|
|
||||||
@commands.command(usage="<users...> [reason]")
|
@commands.command(usage="<users...> [reason]")
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.mod_or_permissions(manage_roles=True)
|
@commands.mod_or_permissions(manage_roles=True)
|
||||||
async def unmute(
|
async def unmute(
|
||||||
self,
|
self,
|
||||||
ctx: commands.Context,
|
ctx: commands.Context,
|
||||||
@ -1478,7 +1478,7 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):
|
|||||||
if issue_list:
|
if issue_list:
|
||||||
await self.handle_issues(ctx, 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.command(name="unmutechannel", aliases=["channelunmute"], usage="<users...> [reason]")
|
||||||
@commands.bot_has_guild_permissions(manage_permissions=True)
|
@commands.bot_has_guild_permissions(manage_permissions=True)
|
||||||
async def unmute_channel(
|
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 datetime import timezone, timedelta, datetime
|
||||||
from .abc import MixinMeta
|
from .abc import MixinMeta
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
from redbot.core import commands, checks, i18n, modlog
|
from redbot.core import commands, i18n, modlog
|
||||||
from redbot.core.utils.chat_formatting import (
|
from redbot.core.utils.chat_formatting import (
|
||||||
bold,
|
|
||||||
humanize_timedelta,
|
humanize_timedelta,
|
||||||
humanize_list,
|
humanize_list,
|
||||||
pagify,
|
pagify,
|
||||||
|
|||||||
@ -7,7 +7,7 @@ from typing import Union, Optional, Dict, List, Tuple, Any, Iterator, ItemsView,
|
|||||||
import discord
|
import discord
|
||||||
import yaml
|
import yaml
|
||||||
from schema import And, Or, Schema, SchemaError, Optional as UseOptional
|
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.bot import Red
|
||||||
from redbot.core.i18n import Translator, cog_i18n
|
from redbot.core.i18n import Translator, cog_i18n
|
||||||
from redbot.core.utils import can_user_react_in
|
from redbot.core.utils import can_user_react_in
|
||||||
@ -268,7 +268,7 @@ class Permissions(commands.Cog):
|
|||||||
)
|
)
|
||||||
await ctx.send(out)
|
await ctx.send(out)
|
||||||
|
|
||||||
@checks.guildowner_or_permissions(administrator=True)
|
@commands.guildowner_or_permissions(administrator=True)
|
||||||
@permissions.group(name="acl", aliases=["yaml"])
|
@permissions.group(name="acl", aliases=["yaml"])
|
||||||
async def permissions_acl(self, ctx: commands.Context):
|
async def permissions_acl(self, ctx: commands.Context):
|
||||||
"""Manage permissions with YAML files."""
|
"""Manage permissions with YAML files."""
|
||||||
@ -296,7 +296,7 @@ class Permissions(commands.Cog):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
@permissions_acl.command(name="setglobal")
|
@permissions_acl.command(name="setglobal")
|
||||||
async def permissions_acl_setglobal(self, ctx: commands.Context):
|
async def permissions_acl_setglobal(self, ctx: commands.Context):
|
||||||
"""Set global rules with a YAML file.
|
"""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)
|
await self._permissions_acl_set(ctx, guild_id=GLOBAL, update=False)
|
||||||
|
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.guildowner_or_permissions(administrator=True)
|
@commands.guildowner_or_permissions(administrator=True)
|
||||||
@permissions_acl.command(name="setserver", aliases=["setguild"])
|
@permissions_acl.command(name="setserver", aliases=["setguild"])
|
||||||
async def permissions_acl_setguild(self, ctx: commands.Context):
|
async def permissions_acl_setguild(self, ctx: commands.Context):
|
||||||
"""Set rules for this server with a YAML file.
|
"""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)
|
await self._permissions_acl_set(ctx, guild_id=ctx.guild.id, update=False)
|
||||||
|
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
@permissions_acl.command(name="getglobal")
|
@permissions_acl.command(name="getglobal")
|
||||||
async def permissions_acl_getglobal(self, ctx: commands.Context):
|
async def permissions_acl_getglobal(self, ctx: commands.Context):
|
||||||
"""Get a YAML file detailing all global rules."""
|
"""Get a YAML file detailing all global rules."""
|
||||||
@ -336,7 +336,7 @@ class Permissions(commands.Cog):
|
|||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.guildowner_or_permissions(administrator=True)
|
@commands.guildowner_or_permissions(administrator=True)
|
||||||
@permissions_acl.command(name="getserver", aliases=["getguild"])
|
@permissions_acl.command(name="getserver", aliases=["getguild"])
|
||||||
async def permissions_acl_getguild(self, ctx: commands.Context):
|
async def permissions_acl_getguild(self, ctx: commands.Context):
|
||||||
"""Get a YAML file detailing all rules in this server."""
|
"""Get a YAML file detailing all rules in this server."""
|
||||||
@ -350,7 +350,7 @@ class Permissions(commands.Cog):
|
|||||||
finally:
|
finally:
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
@permissions_acl.command(name="updateglobal")
|
@permissions_acl.command(name="updateglobal")
|
||||||
async def permissions_acl_updateglobal(self, ctx: commands.Context):
|
async def permissions_acl_updateglobal(self, ctx: commands.Context):
|
||||||
"""Update global rules with a YAML file.
|
"""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)
|
await self._permissions_acl_set(ctx, guild_id=GLOBAL, update=True)
|
||||||
|
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.guildowner_or_permissions(administrator=True)
|
@commands.guildowner_or_permissions(administrator=True)
|
||||||
@permissions_acl.command(name="updateserver", aliases=["updateguild"])
|
@permissions_acl.command(name="updateserver", aliases=["updateguild"])
|
||||||
async def permissions_acl_updateguild(self, ctx: commands.Context):
|
async def permissions_acl_updateguild(self, ctx: commands.Context):
|
||||||
"""Update rules for this server with a YAML file.
|
"""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)
|
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)
|
@permissions.command(name="addglobalrule", require_var_positional=True)
|
||||||
async def permissions_addglobalrule(
|
async def permissions_addglobalrule(
|
||||||
self,
|
self,
|
||||||
@ -399,7 +399,7 @@ class Permissions(commands.Cog):
|
|||||||
await ctx.send(_("Rule added."))
|
await ctx.send(_("Rule added."))
|
||||||
|
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.guildowner_or_permissions(administrator=True)
|
@commands.guildowner_or_permissions(administrator=True)
|
||||||
@permissions.command(
|
@permissions.command(
|
||||||
name="addserverrule", aliases=["addguildrule"], require_var_positional=True
|
name="addserverrule", aliases=["addguildrule"], require_var_positional=True
|
||||||
)
|
)
|
||||||
@ -428,7 +428,7 @@ class Permissions(commands.Cog):
|
|||||||
)
|
)
|
||||||
await ctx.send(_("Rule added."))
|
await ctx.send(_("Rule added."))
|
||||||
|
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
@permissions.command(name="removeglobalrule", require_var_positional=True)
|
@permissions.command(name="removeglobalrule", require_var_positional=True)
|
||||||
async def permissions_removeglobalrule(
|
async def permissions_removeglobalrule(
|
||||||
self,
|
self,
|
||||||
@ -448,7 +448,7 @@ class Permissions(commands.Cog):
|
|||||||
await ctx.send(_("Rule removed."))
|
await ctx.send(_("Rule removed."))
|
||||||
|
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.guildowner_or_permissions(administrator=True)
|
@commands.guildowner_or_permissions(administrator=True)
|
||||||
@permissions.command(
|
@permissions.command(
|
||||||
name="removeserverrule", aliases=["removeguildrule"], require_var_positional=True
|
name="removeserverrule", aliases=["removeguildrule"], require_var_positional=True
|
||||||
)
|
)
|
||||||
@ -472,7 +472,7 @@ class Permissions(commands.Cog):
|
|||||||
await ctx.send(_("Rule removed."))
|
await ctx.send(_("Rule removed."))
|
||||||
|
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.guildowner_or_permissions(administrator=True)
|
@commands.guildowner_or_permissions(administrator=True)
|
||||||
@permissions.command(name="setdefaultserverrule", aliases=["setdefaultguildrule"])
|
@permissions.command(name="setdefaultserverrule", aliases=["setdefaultguildrule"])
|
||||||
async def permissions_setdefaultguildrule(
|
async def permissions_setdefaultguildrule(
|
||||||
self, ctx: commands.Context, allow_or_deny: ClearableRuleType, cog_or_command: CogOrCommand
|
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."))
|
await ctx.send(_("Default set."))
|
||||||
|
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
@permissions.command(name="setdefaultglobalrule")
|
@permissions.command(name="setdefaultglobalrule")
|
||||||
async def permissions_setdefaultglobalrule(
|
async def permissions_setdefaultglobalrule(
|
||||||
self, ctx: commands.Context, allow_or_deny: ClearableRuleType, cog_or_command: CogOrCommand
|
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."))
|
await ctx.send(_("Default set."))
|
||||||
|
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
@permissions.command(name="clearglobalrules")
|
@permissions.command(name="clearglobalrules")
|
||||||
async def permissions_clearglobalrules(self, ctx: commands.Context):
|
async def permissions_clearglobalrules(self, ctx: commands.Context):
|
||||||
"""Reset all global rules."""
|
"""Reset all global rules."""
|
||||||
@ -526,7 +526,7 @@ class Permissions(commands.Cog):
|
|||||||
await ctx.tick()
|
await ctx.tick()
|
||||||
|
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.guildowner_or_permissions(administrator=True)
|
@commands.guildowner_or_permissions(administrator=True)
|
||||||
@permissions.command(name="clearserverrules", aliases=["clearguildrules"])
|
@permissions.command(name="clearserverrules", aliases=["clearguildrules"])
|
||||||
async def permissions_clearguildrules(self, ctx: commands.Context):
|
async def permissions_clearguildrules(self, ctx: commands.Context):
|
||||||
"""Reset all rules in this server."""
|
"""Reset all rules in this server."""
|
||||||
|
|||||||
@ -6,7 +6,7 @@ from copy import copy
|
|||||||
import contextlib
|
import contextlib
|
||||||
import discord
|
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 import AsyncIter
|
||||||
from redbot.core.utils.chat_formatting import pagify, box
|
from redbot.core.utils.chat_formatting import pagify, box
|
||||||
from redbot.core.utils.antispam import AntiSpam
|
from redbot.core.utils.antispam import AntiSpam
|
||||||
@ -97,14 +97,14 @@ class Reports(commands.Cog):
|
|||||||
def tunnels(self):
|
def tunnels(self):
|
||||||
return [x["tun"] for x in self.tunnel_store.values()]
|
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.guild_only()
|
||||||
@commands.group(name="reportset")
|
@commands.group(name="reportset")
|
||||||
async def reportset(self, ctx: commands.Context):
|
async def reportset(self, ctx: commands.Context):
|
||||||
"""Manage Reports."""
|
"""Manage Reports."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@checks.admin_or_permissions(manage_guild=True)
|
@commands.admin_or_permissions(manage_guild=True)
|
||||||
@reportset.command(name="output")
|
@reportset.command(name="output")
|
||||||
async def reportset_output(
|
async def reportset_output(
|
||||||
self, ctx: commands.Context, channel: Union[discord.TextChannel, discord.VoiceChannel]
|
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 self.config.guild(ctx.guild).output_channel.set(channel.id)
|
||||||
await ctx.send(_("The report channel has been set."))
|
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"])
|
@reportset.command(name="toggle", aliases=["toggleactive"])
|
||||||
async def reportset_toggle(self, ctx: commands.Context):
|
async def reportset_toggle(self, ctx: commands.Context):
|
||||||
"""Enable or disable reporting for this server."""
|
"""Enable or disable reporting for this server."""
|
||||||
@ -388,7 +388,7 @@ class Reports(commands.Cog):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.mod_or_permissions(manage_roles=True)
|
@commands.mod_or_permissions(manage_roles=True)
|
||||||
@report.command(name="interact")
|
@report.command(name="interact")
|
||||||
async def response(self, ctx, ticket_number: int):
|
async def response(self, ctx, ticket_number: int):
|
||||||
"""Open a message tunnel.
|
"""Open a message tunnel.
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import discord
|
import discord
|
||||||
from redbot.core.utils.chat_formatting import humanize_list
|
from redbot.core.utils.chat_formatting import humanize_list
|
||||||
from redbot.core.bot import Red
|
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.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._internal_utils import send_to_owners_with_prefix_replaced
|
||||||
from redbot.core.utils.chat_formatting import escape, inline, pagify
|
from redbot.core.utils.chat_formatting import escape, inline, pagify
|
||||||
@ -305,7 +305,7 @@ class Streams(commands.Cog):
|
|||||||
|
|
||||||
@commands.group()
|
@commands.group()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.mod_or_permissions(manage_channels=True)
|
@commands.mod_or_permissions(manage_channels=True)
|
||||||
async def streamalert(self, ctx: commands.Context):
|
async def streamalert(self, ctx: commands.Context):
|
||||||
"""Manage automated stream alerts."""
|
"""Manage automated stream alerts."""
|
||||||
pass
|
pass
|
||||||
@ -494,13 +494,13 @@ class Streams(commands.Cog):
|
|||||||
await self.add_or_remove(ctx, stream, discord_channel)
|
await self.add_or_remove(ctx, stream, discord_channel)
|
||||||
|
|
||||||
@commands.group()
|
@commands.group()
|
||||||
@checks.mod_or_permissions(manage_channels=True)
|
@commands.mod_or_permissions(manage_channels=True)
|
||||||
async def streamset(self, ctx: commands.Context):
|
async def streamset(self, ctx: commands.Context):
|
||||||
"""Manage stream alert settings."""
|
"""Manage stream alert settings."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@streamset.command(name="timer")
|
@streamset.command(name="timer")
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def _streamset_refresh_timer(self, ctx: commands.Context, refresh_time: int):
|
async def _streamset_refresh_timer(self, ctx: commands.Context, refresh_time: int):
|
||||||
"""Set stream check refresh time."""
|
"""Set stream check refresh time."""
|
||||||
if refresh_time < 60:
|
if refresh_time < 60:
|
||||||
@ -512,7 +512,7 @@ class Streams(commands.Cog):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@streamset.command()
|
@streamset.command()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def twitchtoken(self, ctx: commands.Context):
|
async def twitchtoken(self, ctx: commands.Context):
|
||||||
"""Explain how to set the twitch token."""
|
"""Explain how to set the twitch token."""
|
||||||
message = _(
|
message = _(
|
||||||
@ -538,7 +538,7 @@ class Streams(commands.Cog):
|
|||||||
await ctx.maybe_send_embed(message)
|
await ctx.maybe_send_embed(message)
|
||||||
|
|
||||||
@streamset.command()
|
@streamset.command()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def youtubekey(self, ctx: commands.Context):
|
async def youtubekey(self, ctx: commands.Context):
|
||||||
"""Explain how to set the YouTube token."""
|
"""Explain how to set the YouTube token."""
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import io
|
|||||||
import yaml
|
import yaml
|
||||||
import discord
|
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.bot import Red
|
||||||
from redbot.core.data_manager import cog_data_path
|
from redbot.core.data_manager import cog_data_path
|
||||||
from redbot.core.i18n import Translator, cog_i18n
|
from redbot.core.i18n import Translator, cog_i18n
|
||||||
@ -77,7 +77,7 @@ class Trivia(commands.Cog):
|
|||||||
|
|
||||||
@commands.group()
|
@commands.group()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.mod_or_permissions(administrator=True)
|
@commands.mod_or_permissions(administrator=True)
|
||||||
async def triviaset(self, ctx: commands.Context):
|
async def triviaset(self, ctx: commands.Context):
|
||||||
"""Manage Trivia settings."""
|
"""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."))
|
await ctx.send(_("Alright, I won't reveal the answer to the questions anymore."))
|
||||||
|
|
||||||
@bank.is_owner_if_bank_global()
|
@bank.is_owner_if_bank_global()
|
||||||
@checks.admin_or_permissions(manage_guild=True)
|
@commands.admin_or_permissions(manage_guild=True)
|
||||||
@triviaset.command(name="payout")
|
@triviaset.command(name="payout")
|
||||||
async def triviaset_payout_multiplier(self, ctx: commands.Context, multiplier: finite_float):
|
async def triviaset_payout_multiplier(self, ctx: commands.Context, multiplier: finite_float):
|
||||||
"""Set the payout multiplier.
|
"""Set the payout multiplier.
|
||||||
|
|||||||
@ -2,7 +2,7 @@ from copy import copy
|
|||||||
import asyncio
|
import asyncio
|
||||||
import discord
|
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.commands.requires import PrivilegeLevel
|
||||||
from redbot.core.i18n import Translator
|
from redbot.core.i18n import Translator
|
||||||
from redbot.core.utils.predicates import MessagePredicate
|
from redbot.core.utils.predicates import MessagePredicate
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import contextlib
|
|||||||
from datetime import timezone
|
from datetime import timezone
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from copy import copy
|
from copy import copy
|
||||||
from typing import Union, Optional, Literal
|
from typing import Union, Literal
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ from redbot.cogs.warnings.helpers import (
|
|||||||
get_command_for_dropping_points,
|
get_command_for_dropping_points,
|
||||||
warning_points_remove_check,
|
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.bot import Red
|
||||||
from redbot.core.commands import UserInputOptional
|
from redbot.core.commands import UserInputOptional
|
||||||
from redbot.core.i18n import Translator, cog_i18n
|
from redbot.core.i18n import Translator, cog_i18n
|
||||||
@ -110,7 +110,7 @@ class Warnings(commands.Cog):
|
|||||||
|
|
||||||
@commands.group()
|
@commands.group()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.guildowner_or_permissions(administrator=True)
|
@commands.guildowner_or_permissions(administrator=True)
|
||||||
async def warningset(self, ctx: commands.Context):
|
async def warningset(self, ctx: commands.Context):
|
||||||
"""Manage settings for Warnings."""
|
"""Manage settings for Warnings."""
|
||||||
pass
|
pass
|
||||||
@ -195,7 +195,7 @@ class Warnings(commands.Cog):
|
|||||||
|
|
||||||
@commands.group()
|
@commands.group()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.guildowner_or_permissions(administrator=True)
|
@commands.guildowner_or_permissions(administrator=True)
|
||||||
async def warnaction(self, ctx: commands.Context):
|
async def warnaction(self, ctx: commands.Context):
|
||||||
"""Manage automated actions for Warnings.
|
"""Manage automated actions for Warnings.
|
||||||
|
|
||||||
@ -261,7 +261,7 @@ class Warnings(commands.Cog):
|
|||||||
|
|
||||||
@commands.group()
|
@commands.group()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.guildowner_or_permissions(administrator=True)
|
@commands.guildowner_or_permissions(administrator=True)
|
||||||
async def warnreason(self, ctx: commands.Context):
|
async def warnreason(self, ctx: commands.Context):
|
||||||
"""Manage warning reasons.
|
"""Manage warning reasons.
|
||||||
|
|
||||||
@ -305,7 +305,7 @@ class Warnings(commands.Cog):
|
|||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.admin_or_permissions(ban_members=True)
|
@commands.admin_or_permissions(ban_members=True)
|
||||||
async def reasonlist(self, ctx: commands.Context):
|
async def reasonlist(self, ctx: commands.Context):
|
||||||
"""List all configured reasons for Warnings."""
|
"""List all configured reasons for Warnings."""
|
||||||
guild = ctx.guild
|
guild = ctx.guild
|
||||||
@ -334,7 +334,7 @@ class Warnings(commands.Cog):
|
|||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.admin_or_permissions(ban_members=True)
|
@commands.admin_or_permissions(ban_members=True)
|
||||||
async def actionlist(self, ctx: commands.Context):
|
async def actionlist(self, ctx: commands.Context):
|
||||||
"""List all configured automated actions for Warnings."""
|
"""List all configured automated actions for Warnings."""
|
||||||
guild = ctx.guild
|
guild = ctx.guild
|
||||||
@ -369,7 +369,7 @@ class Warnings(commands.Cog):
|
|||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.admin_or_permissions(ban_members=True)
|
@commands.admin_or_permissions(ban_members=True)
|
||||||
async def warn(
|
async def warn(
|
||||||
self,
|
self,
|
||||||
ctx: commands.Context,
|
ctx: commands.Context,
|
||||||
@ -525,7 +525,7 @@ class Warnings(commands.Cog):
|
|||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.admin()
|
@commands.admin()
|
||||||
async def warnings(self, ctx: commands.Context, member: Union[discord.Member, int]):
|
async def warnings(self, ctx: commands.Context, member: Union[discord.Member, int]):
|
||||||
"""List the warnings for the specified user."""
|
"""List the warnings for the specified user."""
|
||||||
|
|
||||||
@ -601,7 +601,7 @@ class Warnings(commands.Cog):
|
|||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.admin_or_permissions(ban_members=True)
|
@commands.admin_or_permissions(ban_members=True)
|
||||||
async def unwarn(
|
async def unwarn(
|
||||||
self,
|
self,
|
||||||
ctx: commands.Context,
|
ctx: commands.Context,
|
||||||
|
|||||||
@ -164,7 +164,7 @@ def is_owner_if_bank_global():
|
|||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
@bank.is_owner_if_bank_global()
|
@bank.is_owner_if_bank_global()
|
||||||
@checks.guildowner()
|
@commands.guildowner()
|
||||||
@commands.group()
|
@commands.group()
|
||||||
async def bankset(self, ctx: commands.Context):
|
async def bankset(self, ctx: commands.Context):
|
||||||
\"""Base command for bank settings.\"""
|
\"""Base command for bank settings.\"""
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
import warnings
|
import warnings
|
||||||
from typing import Awaitable, TYPE_CHECKING, Dict
|
from typing import Awaitable, TYPE_CHECKING, Dict
|
||||||
|
|
||||||
import discord
|
|
||||||
|
|
||||||
from .commands import (
|
from .commands import (
|
||||||
bot_has_permissions,
|
bot_has_permissions,
|
||||||
bot_in_a_guild,
|
bot_in_a_guild,
|
||||||
@ -22,7 +20,6 @@ from .utils.mod import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .bot import Red
|
|
||||||
from .commands import Context
|
from .commands import Context
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
|
|||||||
@ -11,7 +11,7 @@ from redbot.core.commands import BadArgument
|
|||||||
from redbot.core.utils import deduplicate_iterables
|
from redbot.core.utils import deduplicate_iterables
|
||||||
import discord
|
import discord
|
||||||
|
|
||||||
from . import checks, commands
|
from . import commands
|
||||||
from .config import Config
|
from .config import Config
|
||||||
from .i18n import Translator, cog_i18n
|
from .i18n import Translator, cog_i18n
|
||||||
from .data_manager import cog_data_path
|
from .data_manager import cog_data_path
|
||||||
@ -336,7 +336,7 @@ class CogManagerUI(commands.Cog):
|
|||||||
return
|
return
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def paths(self, ctx: commands.Context):
|
async def paths(self, ctx: commands.Context):
|
||||||
"""
|
"""
|
||||||
Lists current cog paths in order of priority.
|
Lists current cog paths in order of priority.
|
||||||
@ -358,7 +358,7 @@ class CogManagerUI(commands.Cog):
|
|||||||
await ctx.send(box(msg))
|
await ctx.send(box(msg))
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def addpath(self, ctx: commands.Context, *, path: Path):
|
async def addpath(self, ctx: commands.Context, *, path: Path):
|
||||||
"""
|
"""
|
||||||
Add a path to the list of available cog paths.
|
Add a path to the list of available cog paths.
|
||||||
@ -375,7 +375,7 @@ class CogManagerUI(commands.Cog):
|
|||||||
await ctx.send(_("Path successfully added."))
|
await ctx.send(_("Path successfully added."))
|
||||||
|
|
||||||
@commands.command(require_var_positional=True)
|
@commands.command(require_var_positional=True)
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def removepath(self, ctx: commands.Context, *path_numbers: positive_int):
|
async def removepath(self, ctx: commands.Context, *path_numbers: positive_int):
|
||||||
"""
|
"""
|
||||||
Removes one or more paths from the available cog paths given the `path_numbers` from `[p]paths`.
|
Removes one or more paths from the available cog paths given the `path_numbers` from `[p]paths`.
|
||||||
@ -413,7 +413,7 @@ class CogManagerUI(commands.Cog):
|
|||||||
await ctx.send(page)
|
await ctx.send(page)
|
||||||
|
|
||||||
@commands.command(usage="<from> <to>")
|
@commands.command(usage="<from> <to>")
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def reorderpath(self, ctx: commands.Context, from_: positive_int, to: positive_int):
|
async def reorderpath(self, ctx: commands.Context, from_: positive_int, to: positive_int):
|
||||||
"""
|
"""
|
||||||
Reorders paths internally to allow discovery of different cogs.
|
Reorders paths internally to allow discovery of different cogs.
|
||||||
@ -439,7 +439,7 @@ class CogManagerUI(commands.Cog):
|
|||||||
await ctx.send(_("Paths reordered."))
|
await ctx.send(_("Paths reordered."))
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def installpath(self, ctx: commands.Context, path: Path = None):
|
async def installpath(self, ctx: commands.Context, path: Path = None):
|
||||||
"""
|
"""
|
||||||
Returns the current install path or sets it if one is provided.
|
Returns the current install path or sets it if one is provided.
|
||||||
@ -464,7 +464,7 @@ class CogManagerUI(commands.Cog):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def cogs(self, ctx: commands.Context):
|
async def cogs(self, ctx: commands.Context):
|
||||||
"""
|
"""
|
||||||
Lists all loaded and available cogs.
|
Lists all loaded and available cogs.
|
||||||
|
|||||||
@ -24,7 +24,6 @@ from typing import (
|
|||||||
Union,
|
Union,
|
||||||
MutableMapping,
|
MutableMapping,
|
||||||
TYPE_CHECKING,
|
TYPE_CHECKING,
|
||||||
cast,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
|
|||||||
@ -11,7 +11,7 @@ from discord.ext.commands import Context as DPYContext
|
|||||||
from .requires import PermState
|
from .requires import PermState
|
||||||
from ..utils.chat_formatting import box, text_to_file
|
from ..utils.chat_formatting import box, text_to_file
|
||||||
from ..utils.predicates import MessagePredicate
|
from ..utils.predicates import MessagePredicate
|
||||||
from ..utils import can_user_react_in, common_filters
|
from ..utils import can_user_react_in
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .commands import Command
|
from .commands import Command
|
||||||
|
|||||||
@ -11,7 +11,6 @@ from datetime import timedelta
|
|||||||
from dateutil.relativedelta import relativedelta
|
from dateutil.relativedelta import relativedelta
|
||||||
from typing import (
|
from typing import (
|
||||||
TYPE_CHECKING,
|
TYPE_CHECKING,
|
||||||
Generic,
|
|
||||||
Optional,
|
Optional,
|
||||||
Optional as NoParseOptional,
|
Optional as NoParseOptional,
|
||||||
Tuple,
|
Tuple,
|
||||||
@ -22,7 +21,6 @@ from typing import (
|
|||||||
Union as UserInputOptional,
|
Union as UserInputOptional,
|
||||||
)
|
)
|
||||||
|
|
||||||
import discord
|
|
||||||
from discord.ext import commands as dpy_commands
|
from discord.ext import commands as dpy_commands
|
||||||
from discord.ext.commands import BadArgument
|
from discord.ext.commands import BadArgument
|
||||||
|
|
||||||
|
|||||||
@ -44,7 +44,6 @@ from redbot.core.data_manager import storage_type
|
|||||||
from . import (
|
from . import (
|
||||||
__version__,
|
__version__,
|
||||||
version_info as red_version_info,
|
version_info as red_version_info,
|
||||||
checks,
|
|
||||||
commands,
|
commands,
|
||||||
errors,
|
errors,
|
||||||
i18n,
|
i18n,
|
||||||
@ -792,7 +791,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
@mydata.group(name="ownermanagement")
|
@mydata.group(name="ownermanagement")
|
||||||
async def mydata_owner_management(self, ctx: commands.Context):
|
async def mydata_owner_management(self, ctx: commands.Context):
|
||||||
"""
|
"""
|
||||||
@ -1176,7 +1175,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(box(text))
|
await ctx.send(box(text))
|
||||||
|
|
||||||
@embedset.command(name="global")
|
@embedset.command(name="global")
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def embedset_global(self, ctx: commands.Context):
|
async def embedset_global(self, ctx: commands.Context):
|
||||||
"""
|
"""
|
||||||
Toggle the global embed setting.
|
Toggle the global embed setting.
|
||||||
@ -1198,7 +1197,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(_("Embeds are now enabled by default."))
|
await ctx.send(_("Embeds are now enabled by default."))
|
||||||
|
|
||||||
@embedset.command(name="server", aliases=["guild"])
|
@embedset.command(name="server", aliases=["guild"])
|
||||||
@checks.guildowner_or_permissions(administrator=True)
|
@commands.guildowner_or_permissions(administrator=True)
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def embedset_guild(self, ctx: commands.Context, enabled: bool = None):
|
async def embedset_guild(self, ctx: commands.Context, enabled: bool = None):
|
||||||
"""
|
"""
|
||||||
@ -1230,7 +1229,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
else _("Embeds are now disabled for this guild.")
|
else _("Embeds are now disabled for this guild.")
|
||||||
)
|
)
|
||||||
|
|
||||||
@checks.guildowner_or_permissions(administrator=True)
|
@commands.guildowner_or_permissions(administrator=True)
|
||||||
@embedset.group(name="command", invoke_without_command=True)
|
@embedset.group(name="command", invoke_without_command=True)
|
||||||
async def embedset_command(
|
async def embedset_command(
|
||||||
self, ctx: commands.Context, command: CommandConverter, enabled: bool = None
|
self, ctx: commands.Context, command: CommandConverter, enabled: bool = None
|
||||||
@ -1361,7 +1360,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@embedset.command(name="channel")
|
@embedset.command(name="channel")
|
||||||
@checks.guildowner_or_permissions(administrator=True)
|
@commands.guildowner_or_permissions(administrator=True)
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def embedset_channel(
|
async def embedset_channel(
|
||||||
self,
|
self,
|
||||||
@ -1432,7 +1431,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def traceback(self, ctx: commands.Context, public: bool = False):
|
async def traceback(self, ctx: commands.Context, public: bool = False):
|
||||||
"""Sends to the owner the last command exception that has occurred.
|
"""Sends to the owner the last command exception that has occurred.
|
||||||
|
|
||||||
@ -1497,7 +1496,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@commands.group()
|
@commands.group()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def inviteset(self, ctx):
|
async def inviteset(self, ctx):
|
||||||
"""Commands to setup [botname]'s invite settings."""
|
"""Commands to setup [botname]'s invite settings."""
|
||||||
pass
|
pass
|
||||||
@ -1581,7 +1580,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def leave(self, ctx: commands.Context, *servers: GuildConverter):
|
async def leave(self, ctx: commands.Context, *servers: GuildConverter):
|
||||||
"""
|
"""
|
||||||
Leaves servers.
|
Leaves servers.
|
||||||
@ -1665,7 +1664,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(_("Alright, I'm not leaving that server."))
|
await ctx.send(_("Alright, I'm not leaving that server."))
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def servers(self, ctx: commands.Context):
|
async def servers(self, ctx: commands.Context):
|
||||||
"""
|
"""
|
||||||
Lists the servers [botname] is currently in.
|
Lists the servers [botname] is currently in.
|
||||||
@ -1685,7 +1684,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await menu(ctx, pages)
|
await menu(ctx, pages)
|
||||||
|
|
||||||
@commands.command(require_var_positional=True)
|
@commands.command(require_var_positional=True)
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def load(self, ctx: commands.Context, *cogs: str):
|
async def load(self, ctx: commands.Context, *cogs: str):
|
||||||
"""Loads cog packages from the local paths and installed cogs.
|
"""Loads cog packages from the local paths and installed cogs.
|
||||||
|
|
||||||
@ -1798,7 +1797,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(page)
|
await ctx.send(page)
|
||||||
|
|
||||||
@commands.command(require_var_positional=True)
|
@commands.command(require_var_positional=True)
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def unload(self, ctx: commands.Context, *cogs: str):
|
async def unload(self, ctx: commands.Context, *cogs: str):
|
||||||
"""Unloads previously loaded cog packages.
|
"""Unloads previously loaded cog packages.
|
||||||
|
|
||||||
@ -1844,7 +1843,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(page)
|
await ctx.send(page)
|
||||||
|
|
||||||
@commands.command(require_var_positional=True)
|
@commands.command(require_var_positional=True)
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def reload(self, ctx: commands.Context, *cogs: str):
|
async def reload(self, ctx: commands.Context, *cogs: str):
|
||||||
"""Reloads cog packages.
|
"""Reloads cog packages.
|
||||||
|
|
||||||
@ -1947,7 +1946,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
|
|
||||||
# TODO: Guild owner permissions for guild scope slash commands and syncing?
|
# TODO: Guild owner permissions for guild scope slash commands and syncing?
|
||||||
@commands.group()
|
@commands.group()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def slash(self, ctx: commands.Context):
|
async def slash(self, ctx: commands.Context):
|
||||||
"""Base command for managing what application commands are able to be used on [botname]."""
|
"""Base command for managing what application commands are able to be used on [botname]."""
|
||||||
|
|
||||||
@ -2330,7 +2329,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@commands.command(name="shutdown")
|
@commands.command(name="shutdown")
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def _shutdown(self, ctx: commands.Context, silently: bool = False):
|
async def _shutdown(self, ctx: commands.Context, silently: bool = False):
|
||||||
"""Shuts down the bot.
|
"""Shuts down the bot.
|
||||||
|
|
||||||
@ -2353,7 +2352,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.bot.shutdown()
|
await ctx.bot.shutdown()
|
||||||
|
|
||||||
@commands.command(name="restart")
|
@commands.command(name="restart")
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def _restart(self, ctx: commands.Context, silently: bool = False):
|
async def _restart(self, ctx: commands.Context, silently: bool = False):
|
||||||
"""Attempts to restart [botname].
|
"""Attempts to restart [botname].
|
||||||
|
|
||||||
@ -2373,7 +2372,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.bot.shutdown(restart=True)
|
await ctx.bot.shutdown(restart=True)
|
||||||
|
|
||||||
@bank.is_owner_if_bank_global()
|
@bank.is_owner_if_bank_global()
|
||||||
@checks.guildowner_or_permissions(administrator=True)
|
@commands.guildowner_or_permissions(administrator=True)
|
||||||
@commands.group()
|
@commands.group()
|
||||||
async def bankset(self, ctx: commands.Context):
|
async def bankset(self, ctx: commands.Context):
|
||||||
"""Base command for bank settings."""
|
"""Base command for bank settings."""
|
||||||
@ -2409,7 +2408,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(box(settings))
|
await ctx.send(box(settings))
|
||||||
|
|
||||||
@bankset.command(name="toggleglobal")
|
@bankset.command(name="toggleglobal")
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def bankset_toggleglobal(self, ctx: commands.Context, confirm: bool = False):
|
async def bankset_toggleglobal(self, ctx: commands.Context, confirm: bool = False):
|
||||||
"""Toggle whether the bank is global or not.
|
"""Toggle whether the bank is global or not.
|
||||||
|
|
||||||
@ -2431,7 +2430,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(_("The bank is now {banktype}.").format(banktype=word))
|
await ctx.send(_("The bank is now {banktype}.").format(banktype=word))
|
||||||
|
|
||||||
@bank.is_owner_if_bank_global()
|
@bank.is_owner_if_bank_global()
|
||||||
@checks.guildowner_or_permissions(administrator=True)
|
@commands.guildowner_or_permissions(administrator=True)
|
||||||
@bankset.command(name="bankname")
|
@bankset.command(name="bankname")
|
||||||
async def bankset_bankname(self, ctx: commands.Context, *, name: str):
|
async def bankset_bankname(self, ctx: commands.Context, *, name: str):
|
||||||
"""Set the bank's name."""
|
"""Set the bank's name."""
|
||||||
@ -2439,7 +2438,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(_("Bank name has been set to: {name}").format(name=name))
|
await ctx.send(_("Bank name has been set to: {name}").format(name=name))
|
||||||
|
|
||||||
@bank.is_owner_if_bank_global()
|
@bank.is_owner_if_bank_global()
|
||||||
@checks.guildowner_or_permissions(administrator=True)
|
@commands.guildowner_or_permissions(administrator=True)
|
||||||
@bankset.command(name="creditsname")
|
@bankset.command(name="creditsname")
|
||||||
async def bankset_creditsname(self, ctx: commands.Context, *, name: str):
|
async def bankset_creditsname(self, ctx: commands.Context, *, name: str):
|
||||||
"""Set the name for the bank's currency."""
|
"""Set the name for the bank's currency."""
|
||||||
@ -2447,7 +2446,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(_("Currency name has been set to: {name}").format(name=name))
|
await ctx.send(_("Currency name has been set to: {name}").format(name=name))
|
||||||
|
|
||||||
@bank.is_owner_if_bank_global()
|
@bank.is_owner_if_bank_global()
|
||||||
@checks.guildowner_or_permissions(administrator=True)
|
@commands.guildowner_or_permissions(administrator=True)
|
||||||
@bankset.command(name="maxbal")
|
@bankset.command(name="maxbal")
|
||||||
async def bankset_maxbal(self, ctx: commands.Context, *, amount: int):
|
async def bankset_maxbal(self, ctx: commands.Context, *, amount: int):
|
||||||
"""Set the maximum balance a user can get."""
|
"""Set the maximum balance a user can get."""
|
||||||
@ -2465,7 +2464,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@bank.is_owner_if_bank_global()
|
@bank.is_owner_if_bank_global()
|
||||||
@checks.guildowner_or_permissions(administrator=True)
|
@commands.guildowner_or_permissions(administrator=True)
|
||||||
@bankset.command(name="registeramount")
|
@bankset.command(name="registeramount")
|
||||||
async def bankset_registeramount(self, ctx: commands.Context, creds: int):
|
async def bankset_registeramount(self, ctx: commands.Context, creds: int):
|
||||||
"""Set the initial balance for new bank accounts.
|
"""Set the initial balance for new bank accounts.
|
||||||
@ -2495,7 +2494,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@bank.is_owner_if_bank_global()
|
@bank.is_owner_if_bank_global()
|
||||||
@checks.guildowner_or_permissions(administrator=True)
|
@commands.guildowner_or_permissions(administrator=True)
|
||||||
@bankset.command(name="reset")
|
@bankset.command(name="reset")
|
||||||
async def bankset_reset(self, ctx, confirmation: bool = False):
|
async def bankset_reset(self, ctx, confirmation: bool = False):
|
||||||
"""Delete all bank accounts.
|
"""Delete all bank accounts.
|
||||||
@ -2527,7 +2526,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@bank.is_owner_if_bank_global()
|
@bank.is_owner_if_bank_global()
|
||||||
@checks.admin_or_permissions(manage_guild=True)
|
@commands.admin_or_permissions(manage_guild=True)
|
||||||
@bankset.group(name="prune")
|
@bankset.group(name="prune")
|
||||||
async def bankset_prune(self, ctx):
|
async def bankset_prune(self, ctx):
|
||||||
"""Base command for pruning bank accounts."""
|
"""Base command for pruning bank accounts."""
|
||||||
@ -2535,7 +2534,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
|
|
||||||
@bankset_prune.command(name="server", aliases=["guild", "local"])
|
@bankset_prune.command(name="server", aliases=["guild", "local"])
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.guildowner()
|
@commands.guildowner()
|
||||||
async def bankset_prune_local(self, ctx, confirmation: bool = False):
|
async def bankset_prune_local(self, ctx, confirmation: bool = False):
|
||||||
"""Prune bank accounts for users no longer in the server.
|
"""Prune bank accounts for users no longer in the server.
|
||||||
|
|
||||||
@ -2568,7 +2567,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@bankset_prune.command(name="global")
|
@bankset_prune.command(name="global")
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def bankset_prune_global(self, ctx, confirmation: bool = False):
|
async def bankset_prune_global(self, ctx, confirmation: bool = False):
|
||||||
"""Prune bank accounts for users who no longer share a server with the bot.
|
"""Prune bank accounts for users who no longer share a server with the bot.
|
||||||
|
|
||||||
@ -2641,12 +2640,12 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(_("The bank account for {name} has been pruned.").format(name=name))
|
await ctx.send(_("The bank account for {name} has been pruned.").format(name=name))
|
||||||
|
|
||||||
@commands.group()
|
@commands.group()
|
||||||
@checks.guildowner_or_permissions(administrator=True)
|
@commands.guildowner_or_permissions(administrator=True)
|
||||||
async def modlogset(self, ctx: commands.Context):
|
async def modlogset(self, ctx: commands.Context):
|
||||||
"""Manage modlog settings."""
|
"""Manage modlog settings."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
@modlogset.command(hidden=True, name="fixcasetypes")
|
@modlogset.command(hidden=True, name="fixcasetypes")
|
||||||
async def modlogset_fixcasetypes(self, ctx: commands.Context):
|
async def modlogset_fixcasetypes(self, ctx: commands.Context):
|
||||||
"""Command to fix misbehaving casetypes."""
|
"""Command to fix misbehaving casetypes."""
|
||||||
@ -2749,11 +2748,11 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
# -- Bot Metadata Commands -- ###
|
# -- Bot Metadata Commands -- ###
|
||||||
|
|
||||||
@_set.group(name="bot", aliases=["metadata"])
|
@_set.group(name="bot", aliases=["metadata"])
|
||||||
@checks.admin_or_permissions(manage_nicknames=True)
|
@commands.admin_or_permissions(manage_nicknames=True)
|
||||||
async def _set_bot(self, ctx: commands.Context):
|
async def _set_bot(self, ctx: commands.Context):
|
||||||
"""Commands for changing [botname]'s metadata."""
|
"""Commands for changing [botname]'s metadata."""
|
||||||
|
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
@_set_bot.command(name="description")
|
@_set_bot.command(name="description")
|
||||||
async def _set_bot_description(self, ctx: commands.Context, *, description: str = ""):
|
async def _set_bot_description(self, ctx: commands.Context, *, description: str = ""):
|
||||||
"""
|
"""
|
||||||
@ -2790,7 +2789,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.tick()
|
await ctx.tick()
|
||||||
|
|
||||||
@_set_bot.group(name="avatar", invoke_without_command=True)
|
@_set_bot.group(name="avatar", invoke_without_command=True)
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def _set_bot_avatar(self, ctx: commands.Context, url: str = None):
|
async def _set_bot_avatar(self, ctx: commands.Context, url: str = None):
|
||||||
"""Sets [botname]'s avatar
|
"""Sets [botname]'s avatar
|
||||||
|
|
||||||
@ -2839,7 +2838,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(_("Done."))
|
await ctx.send(_("Done."))
|
||||||
|
|
||||||
@_set_bot_avatar.command(name="remove", aliases=["clear"])
|
@_set_bot_avatar.command(name="remove", aliases=["clear"])
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def _set_bot_avatar_remove(self, ctx: commands.Context):
|
async def _set_bot_avatar_remove(self, ctx: commands.Context):
|
||||||
"""
|
"""
|
||||||
Removes [botname]'s avatar.
|
Removes [botname]'s avatar.
|
||||||
@ -2852,7 +2851,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(_("Avatar removed."))
|
await ctx.send(_("Avatar removed."))
|
||||||
|
|
||||||
@_set_bot.command(name="username", aliases=["name"])
|
@_set_bot.command(name="username", aliases=["name"])
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def _set_bot_username(self, ctx: commands.Context, *, username: str):
|
async def _set_bot_username(self, ctx: commands.Context, *, username: str):
|
||||||
"""Sets [botname]'s username.
|
"""Sets [botname]'s username.
|
||||||
|
|
||||||
@ -2908,7 +2907,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(_("Done."))
|
await ctx.send(_("Done."))
|
||||||
|
|
||||||
@_set_bot.command(name="nickname")
|
@_set_bot.command(name="nickname")
|
||||||
@checks.admin_or_permissions(manage_nicknames=True)
|
@commands.admin_or_permissions(manage_nicknames=True)
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def _set_bot_nickname(self, ctx: commands.Context, *, nickname: str = None):
|
async def _set_bot_nickname(self, ctx: commands.Context, *, nickname: str = None):
|
||||||
"""Sets [botname]'s nickname for the current server.
|
"""Sets [botname]'s nickname for the current server.
|
||||||
@ -2932,7 +2931,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(_("Done."))
|
await ctx.send(_("Done."))
|
||||||
|
|
||||||
@_set_bot.command(name="custominfo")
|
@_set_bot.command(name="custominfo")
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def _set_bot_custominfo(self, ctx: commands.Context, *, text: str = None):
|
async def _set_bot_custominfo(self, ctx: commands.Context, *, text: str = None):
|
||||||
"""Customizes a section of `[p]info`.
|
"""Customizes a section of `[p]info`.
|
||||||
|
|
||||||
@ -2964,16 +2963,16 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
# -- Bot Status Commands -- ###
|
# -- Bot Status Commands -- ###
|
||||||
|
|
||||||
@_set.group(name="status")
|
@_set.group(name="status")
|
||||||
@checks.bot_in_a_guild()
|
@commands.bot_in_a_guild()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def _set_status(self, ctx: commands.Context):
|
async def _set_status(self, ctx: commands.Context):
|
||||||
"""Commands for setting [botname]'s status."""
|
"""Commands for setting [botname]'s status."""
|
||||||
|
|
||||||
@_set_status.command(
|
@_set_status.command(
|
||||||
name="streaming", aliases=["stream", "twitch"], usage="[(<streamer> <stream_title>)]"
|
name="streaming", aliases=["stream", "twitch"], usage="[(<streamer> <stream_title>)]"
|
||||||
)
|
)
|
||||||
@checks.bot_in_a_guild()
|
@commands.bot_in_a_guild()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def _set_status_stream(self, ctx: commands.Context, streamer=None, *, stream_title=None):
|
async def _set_status_stream(self, ctx: commands.Context, streamer=None, *, stream_title=None):
|
||||||
"""Sets [botname]'s streaming status to a twitch stream.
|
"""Sets [botname]'s streaming status to a twitch stream.
|
||||||
|
|
||||||
@ -3014,8 +3013,8 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(_("Done."))
|
await ctx.send(_("Done."))
|
||||||
|
|
||||||
@_set_status.command(name="playing", aliases=["game"])
|
@_set_status.command(name="playing", aliases=["game"])
|
||||||
@checks.bot_in_a_guild()
|
@commands.bot_in_a_guild()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def _set_status_game(self, ctx: commands.Context, *, game: str = None):
|
async def _set_status_game(self, ctx: commands.Context, *, game: str = None):
|
||||||
"""Sets [botname]'s playing status.
|
"""Sets [botname]'s playing status.
|
||||||
|
|
||||||
@ -3046,8 +3045,8 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(_("Game cleared."))
|
await ctx.send(_("Game cleared."))
|
||||||
|
|
||||||
@_set_status.command(name="listening")
|
@_set_status.command(name="listening")
|
||||||
@checks.bot_in_a_guild()
|
@commands.bot_in_a_guild()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def _set_status_listening(self, ctx: commands.Context, *, listening: str = None):
|
async def _set_status_listening(self, ctx: commands.Context, *, listening: str = None):
|
||||||
"""Sets [botname]'s listening status.
|
"""Sets [botname]'s listening status.
|
||||||
|
|
||||||
@ -3082,8 +3081,8 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(_("Listening cleared."))
|
await ctx.send(_("Listening cleared."))
|
||||||
|
|
||||||
@_set_status.command(name="watching")
|
@_set_status.command(name="watching")
|
||||||
@checks.bot_in_a_guild()
|
@commands.bot_in_a_guild()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def _set_status_watching(self, ctx: commands.Context, *, watching: str = None):
|
async def _set_status_watching(self, ctx: commands.Context, *, watching: str = None):
|
||||||
"""Sets [botname]'s watching status.
|
"""Sets [botname]'s watching status.
|
||||||
|
|
||||||
@ -3114,8 +3113,8 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(_("Watching cleared."))
|
await ctx.send(_("Watching cleared."))
|
||||||
|
|
||||||
@_set_status.command(name="competing")
|
@_set_status.command(name="competing")
|
||||||
@checks.bot_in_a_guild()
|
@commands.bot_in_a_guild()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def _set_status_competing(self, ctx: commands.Context, *, competing: str = None):
|
async def _set_status_competing(self, ctx: commands.Context, *, competing: str = None):
|
||||||
"""Sets [botname]'s competing status.
|
"""Sets [botname]'s competing status.
|
||||||
|
|
||||||
@ -3155,29 +3154,29 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
return await ctx.send(_("Status changed to {}.").format(status))
|
return await ctx.send(_("Status changed to {}.").format(status))
|
||||||
|
|
||||||
@_set_status.command(name="online")
|
@_set_status.command(name="online")
|
||||||
@checks.bot_in_a_guild()
|
@commands.bot_in_a_guild()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def _set_status_online(self, ctx: commands.Context):
|
async def _set_status_online(self, ctx: commands.Context):
|
||||||
"""Set [botname]'s status to online."""
|
"""Set [botname]'s status to online."""
|
||||||
await self._set_my_status(ctx, discord.Status.online)
|
await self._set_my_status(ctx, discord.Status.online)
|
||||||
|
|
||||||
@_set_status.command(name="dnd", aliases=["donotdisturb", "busy"])
|
@_set_status.command(name="dnd", aliases=["donotdisturb", "busy"])
|
||||||
@checks.bot_in_a_guild()
|
@commands.bot_in_a_guild()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def _set_status_dnd(self, ctx: commands.Context):
|
async def _set_status_dnd(self, ctx: commands.Context):
|
||||||
"""Set [botname]'s status to do not disturb."""
|
"""Set [botname]'s status to do not disturb."""
|
||||||
await self._set_my_status(ctx, discord.Status.do_not_disturb)
|
await self._set_my_status(ctx, discord.Status.do_not_disturb)
|
||||||
|
|
||||||
@_set_status.command(name="idle", aliases=["away", "afk"])
|
@_set_status.command(name="idle", aliases=["away", "afk"])
|
||||||
@checks.bot_in_a_guild()
|
@commands.bot_in_a_guild()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def _set_status_idle(self, ctx: commands.Context):
|
async def _set_status_idle(self, ctx: commands.Context):
|
||||||
"""Set [botname]'s status to idle."""
|
"""Set [botname]'s status to idle."""
|
||||||
await self._set_my_status(ctx, discord.Status.idle)
|
await self._set_my_status(ctx, discord.Status.idle)
|
||||||
|
|
||||||
@_set_status.command(name="invisible", aliases=["offline"])
|
@_set_status.command(name="invisible", aliases=["offline"])
|
||||||
@checks.bot_in_a_guild()
|
@commands.bot_in_a_guild()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def _set_status_invisible(self, ctx: commands.Context):
|
async def _set_status_invisible(self, ctx: commands.Context):
|
||||||
"""Set [botname]'s status to invisible."""
|
"""Set [botname]'s status to invisible."""
|
||||||
await self._set_my_status(ctx, discord.Status.invisible)
|
await self._set_my_status(ctx, discord.Status.invisible)
|
||||||
@ -3186,13 +3185,13 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
# -- Bot Roles Commands -- ###
|
# -- Bot Roles Commands -- ###
|
||||||
|
|
||||||
@_set.group(name="roles")
|
@_set.group(name="roles")
|
||||||
@checks.guildowner()
|
@commands.guildowner()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def _set_roles(self, ctx: commands.Context):
|
async def _set_roles(self, ctx: commands.Context):
|
||||||
"""Set server's admin and mod roles for [botname]."""
|
"""Set server's admin and mod roles for [botname]."""
|
||||||
|
|
||||||
@_set_roles.command(name="addadminrole")
|
@_set_roles.command(name="addadminrole")
|
||||||
@checks.guildowner()
|
@commands.guildowner()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def _set_roles_addadminrole(self, ctx: commands.Context, *, role: discord.Role):
|
async def _set_roles_addadminrole(self, ctx: commands.Context, *, role: discord.Role):
|
||||||
"""
|
"""
|
||||||
@ -3220,7 +3219,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(_("That role is now considered an admin role."))
|
await ctx.send(_("That role is now considered an admin role."))
|
||||||
|
|
||||||
@_set_roles.command(name="addmodrole")
|
@_set_roles.command(name="addmodrole")
|
||||||
@checks.guildowner()
|
@commands.guildowner()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def _set_roles_addmodrole(self, ctx: commands.Context, *, role: discord.Role):
|
async def _set_roles_addmodrole(self, ctx: commands.Context, *, role: discord.Role):
|
||||||
"""
|
"""
|
||||||
@ -3249,7 +3248,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
@_set_roles.command(
|
@_set_roles.command(
|
||||||
name="removeadminrole", aliases=["remadmindrole", "deladminrole", "deleteadminrole"]
|
name="removeadminrole", aliases=["remadmindrole", "deladminrole", "deleteadminrole"]
|
||||||
)
|
)
|
||||||
@checks.guildowner()
|
@commands.guildowner()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def _set_roles_removeadminrole(self, ctx: commands.Context, *, role: discord.Role):
|
async def _set_roles_removeadminrole(self, ctx: commands.Context, *, role: discord.Role):
|
||||||
"""
|
"""
|
||||||
@ -3271,7 +3270,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
@_set_roles.command(
|
@_set_roles.command(
|
||||||
name="removemodrole", aliases=["remmodrole", "delmodrole", "deletemodrole"]
|
name="removemodrole", aliases=["remmodrole", "delmodrole", "deletemodrole"]
|
||||||
)
|
)
|
||||||
@checks.guildowner()
|
@commands.guildowner()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def _set_roles_removemodrole(self, ctx: commands.Context, *, role: discord.Role):
|
async def _set_roles_removemodrole(self, ctx: commands.Context, *, role: discord.Role):
|
||||||
"""
|
"""
|
||||||
@ -3294,7 +3293,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
# -- Set Locale Commands -- ###
|
# -- Set Locale Commands -- ###
|
||||||
|
|
||||||
@_set.group(name="locale", invoke_without_command=True)
|
@_set.group(name="locale", invoke_without_command=True)
|
||||||
@checks.guildowner_or_permissions(manage_guild=True)
|
@commands.guildowner_or_permissions(manage_guild=True)
|
||||||
async def _set_locale(self, ctx: commands.Context, language_code: str):
|
async def _set_locale(self, ctx: commands.Context, language_code: str):
|
||||||
"""
|
"""
|
||||||
Changes [botname]'s locale in this server.
|
Changes [botname]'s locale in this server.
|
||||||
@ -3321,7 +3320,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.invoke(self._set_locale_local, language_code)
|
await ctx.invoke(self._set_locale_local, language_code)
|
||||||
|
|
||||||
@_set_locale.command(name="global")
|
@_set_locale.command(name="global")
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def _set_locale_global(self, ctx: commands.Context, language_code: str):
|
async def _set_locale_global(self, ctx: commands.Context, language_code: str):
|
||||||
"""
|
"""
|
||||||
Changes [botname]'s default locale.
|
Changes [botname]'s default locale.
|
||||||
@ -3359,7 +3358,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
|
|
||||||
@_set_locale.command(name="server", aliases=["local", "guild"])
|
@_set_locale.command(name="server", aliases=["local", "guild"])
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.guildowner_or_permissions(manage_guild=True)
|
@commands.guildowner_or_permissions(manage_guild=True)
|
||||||
async def _set_locale_local(self, ctx: commands.Context, language_code: str):
|
async def _set_locale_local(self, ctx: commands.Context, language_code: str):
|
||||||
"""
|
"""
|
||||||
Changes [botname]'s locale in this server.
|
Changes [botname]'s locale in this server.
|
||||||
@ -3400,7 +3399,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(_("Locale has been set."))
|
await ctx.send(_("Locale has been set."))
|
||||||
|
|
||||||
@_set.group(name="regionalformat", aliases=["region"], invoke_without_command=True)
|
@_set.group(name="regionalformat", aliases=["region"], invoke_without_command=True)
|
||||||
@checks.guildowner_or_permissions(manage_guild=True)
|
@commands.guildowner_or_permissions(manage_guild=True)
|
||||||
async def _set_regional_format(self, ctx: commands.Context, language_code: str):
|
async def _set_regional_format(self, ctx: commands.Context, language_code: str):
|
||||||
"""
|
"""
|
||||||
Changes the bot's regional format in this server. This is used for formatting date, time and numbers.
|
Changes the bot's regional format in this server. This is used for formatting date, time and numbers.
|
||||||
@ -3424,7 +3423,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.invoke(self._set_regional_format_local, language_code)
|
await ctx.invoke(self._set_regional_format_local, language_code)
|
||||||
|
|
||||||
@_set_regional_format.command(name="global")
|
@_set_regional_format.command(name="global")
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def _set_regional_format_global(self, ctx: commands.Context, language_code: str):
|
async def _set_regional_format_global(self, ctx: commands.Context, language_code: str):
|
||||||
"""
|
"""
|
||||||
Changes the bot's regional format. This is used for formatting date, time and numbers.
|
Changes the bot's regional format. This is used for formatting date, time and numbers.
|
||||||
@ -3467,7 +3466,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
|
|
||||||
@_set_regional_format.command(name="server", aliases=["local", "guild"])
|
@_set_regional_format.command(name="server", aliases=["local", "guild"])
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.guildowner_or_permissions(manage_guild=True)
|
@commands.guildowner_or_permissions(manage_guild=True)
|
||||||
async def _set_regional_format_local(self, ctx: commands.Context, language_code: str):
|
async def _set_regional_format_local(self, ctx: commands.Context, language_code: str):
|
||||||
"""
|
"""
|
||||||
Changes the bot's regional format in this server. This is used for formatting date, time and numbers.
|
Changes the bot's regional format in this server. This is used for formatting date, time and numbers.
|
||||||
@ -3514,7 +3513,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
# -- Set Api Commands -- ###
|
# -- Set Api Commands -- ###
|
||||||
|
|
||||||
@_set.group(name="api", invoke_without_command=True)
|
@_set.group(name="api", invoke_without_command=True)
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def _set_api(
|
async def _set_api(
|
||||||
self,
|
self,
|
||||||
ctx: commands.Context,
|
ctx: commands.Context,
|
||||||
@ -3614,7 +3613,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
# -- End Set Api Commands -- ###
|
# -- End Set Api Commands -- ###
|
||||||
# -- Set Ownernotifications Commands -- ###
|
# -- Set Ownernotifications Commands -- ###
|
||||||
|
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
@_set.group(name="ownernotifications")
|
@_set.group(name="ownernotifications")
|
||||||
async def _set_ownernotifications(self, ctx: commands.Context):
|
async def _set_ownernotifications(self, ctx: commands.Context):
|
||||||
"""
|
"""
|
||||||
@ -3806,7 +3805,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
for page in pagify(settings):
|
for page in pagify(settings):
|
||||||
await ctx.send(box(page))
|
await ctx.send(box(page))
|
||||||
|
|
||||||
@checks.guildowner_or_permissions(administrator=True)
|
@commands.guildowner_or_permissions(administrator=True)
|
||||||
@_set.command(name="deletedelay")
|
@_set.command(name="deletedelay")
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def _set_deletedelay(self, ctx: commands.Context, time: int = None):
|
async def _set_deletedelay(self, ctx: commands.Context, time: int = None):
|
||||||
@ -3848,7 +3847,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(_("I will not delete command messages."))
|
await ctx.send(_("I will not delete command messages."))
|
||||||
|
|
||||||
@_set.command(name="usebotcolour", aliases=["usebotcolor"])
|
@_set.command(name="usebotcolour", aliases=["usebotcolor"])
|
||||||
@checks.guildowner()
|
@commands.guildowner()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def _set_usebotcolour(self, ctx: commands.Context):
|
async def _set_usebotcolour(self, ctx: commands.Context):
|
||||||
"""
|
"""
|
||||||
@ -3869,7 +3868,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@_set.command(name="serverfuzzy")
|
@_set.command(name="serverfuzzy")
|
||||||
@checks.guildowner()
|
@commands.guildowner()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def _set_serverfuzzy(self, ctx: commands.Context):
|
async def _set_serverfuzzy(self, ctx: commands.Context):
|
||||||
"""
|
"""
|
||||||
@ -3893,7 +3892,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@_set.command(name="fuzzy")
|
@_set.command(name="fuzzy")
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def _set_fuzzy(self, ctx: commands.Context):
|
async def _set_fuzzy(self, ctx: commands.Context):
|
||||||
"""
|
"""
|
||||||
Toggle whether to enable fuzzy command search in DMs.
|
Toggle whether to enable fuzzy command search in DMs.
|
||||||
@ -3914,7 +3913,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@_set.command(name="colour", aliases=["color"])
|
@_set.command(name="colour", aliases=["color"])
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def _set_colour(self, ctx: commands.Context, *, colour: discord.Colour = None):
|
async def _set_colour(self, ctx: commands.Context, *, colour: discord.Colour = None):
|
||||||
"""
|
"""
|
||||||
Sets a default colour to be used for the bot's embeds.
|
Sets a default colour to be used for the bot's embeds.
|
||||||
@ -3946,7 +3945,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
aliases=["prefixes", "globalprefix", "globalprefixes"],
|
aliases=["prefixes", "globalprefix", "globalprefixes"],
|
||||||
require_var_positional=True,
|
require_var_positional=True,
|
||||||
)
|
)
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def _set_prefix(self, ctx: commands.Context, *prefixes: str):
|
async def _set_prefix(self, ctx: commands.Context, *prefixes: str):
|
||||||
"""Sets [botname]'s global prefix(es).
|
"""Sets [botname]'s global prefix(es).
|
||||||
|
|
||||||
@ -3993,7 +3992,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(_("Prefixes set."))
|
await ctx.send(_("Prefixes set."))
|
||||||
|
|
||||||
@_set.command(name="serverprefix", aliases=["serverprefixes"])
|
@_set.command(name="serverprefix", aliases=["serverprefixes"])
|
||||||
@checks.admin_or_permissions(manage_guild=True)
|
@commands.admin_or_permissions(manage_guild=True)
|
||||||
async def _set_serverprefix(
|
async def _set_serverprefix(
|
||||||
self, ctx: commands.Context, server: Optional[discord.Guild], *prefixes: str
|
self, ctx: commands.Context, server: Optional[discord.Guild], *prefixes: str
|
||||||
):
|
):
|
||||||
@ -4037,7 +4036,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(_("Server prefixes set."))
|
await ctx.send(_("Server prefixes set."))
|
||||||
|
|
||||||
@_set.command(name="usebuttons")
|
@_set.command(name="usebuttons")
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def _set_usebuttons(self, ctx: commands.Context, use_buttons: bool = None):
|
async def _set_usebuttons(self, ctx: commands.Context, use_buttons: bool = None):
|
||||||
"""
|
"""
|
||||||
Set a global bot variable for using buttons in menus.
|
Set a global bot variable for using buttons in menus.
|
||||||
@ -4092,7 +4091,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(content)
|
await ctx.send(content)
|
||||||
|
|
||||||
@commands.group()
|
@commands.group()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def helpset(self, ctx: commands.Context):
|
async def helpset(self, ctx: commands.Context):
|
||||||
"""
|
"""
|
||||||
Commands to manage settings for the help command.
|
Commands to manage settings for the help command.
|
||||||
@ -4557,7 +4556,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(_("I'm unable to deliver your message. Sorry."))
|
await ctx.send(_("I'm unable to deliver your message. Sorry."))
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def dm(self, ctx: commands.Context, user_id: int, *, message: str):
|
async def dm(self, ctx: commands.Context, user_id: int, *, message: str):
|
||||||
"""Sends a DM to a user.
|
"""Sends a DM to a user.
|
||||||
|
|
||||||
@ -4613,7 +4612,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(_("Message delivered to {}").format(destination))
|
await ctx.send(_("Message delivered to {}").format(destination))
|
||||||
|
|
||||||
@commands.command(hidden=True)
|
@commands.command(hidden=True)
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def datapath(self, ctx: commands.Context):
|
async def datapath(self, ctx: commands.Context):
|
||||||
"""Prints the bot's data path."""
|
"""Prints the bot's data path."""
|
||||||
from redbot.core.data_manager import basic_config
|
from redbot.core.data_manager import basic_config
|
||||||
@ -4623,7 +4622,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(box(msg))
|
await ctx.send(box(msg))
|
||||||
|
|
||||||
@commands.command(hidden=True)
|
@commands.command(hidden=True)
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def debuginfo(self, ctx: commands.Context):
|
async def debuginfo(self, ctx: commands.Context):
|
||||||
"""Shows debug information useful for debugging."""
|
"""Shows debug information useful for debugging."""
|
||||||
from redbot.core._debuginfo import DebugInfo
|
from redbot.core._debuginfo import DebugInfo
|
||||||
@ -4697,7 +4696,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(await issue_diagnoser.diagnose())
|
await ctx.send(await issue_diagnoser.diagnose())
|
||||||
|
|
||||||
@commands.group(aliases=["whitelist"])
|
@commands.group(aliases=["whitelist"])
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def allowlist(self, ctx: commands.Context):
|
async def allowlist(self, ctx: commands.Context):
|
||||||
"""
|
"""
|
||||||
Commands to manage the allowlist.
|
Commands to manage the allowlist.
|
||||||
@ -4786,7 +4785,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(_("Allowlist has been cleared."))
|
await ctx.send(_("Allowlist has been cleared."))
|
||||||
|
|
||||||
@commands.group(aliases=["blacklist", "denylist"])
|
@commands.group(aliases=["blacklist", "denylist"])
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def blocklist(self, ctx: commands.Context):
|
async def blocklist(self, ctx: commands.Context):
|
||||||
"""
|
"""
|
||||||
Commands to manage the blocklist.
|
Commands to manage the blocklist.
|
||||||
@ -4879,7 +4878,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
|
|
||||||
@commands.group(aliases=["localwhitelist"])
|
@commands.group(aliases=["localwhitelist"])
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.admin_or_permissions(administrator=True)
|
@commands.admin_or_permissions(administrator=True)
|
||||||
async def localallowlist(self, ctx: commands.Context):
|
async def localallowlist(self, ctx: commands.Context):
|
||||||
"""
|
"""
|
||||||
Commands to manage the server specific allowlist.
|
Commands to manage the server specific allowlist.
|
||||||
@ -5004,7 +5003,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
|
|
||||||
@commands.group(aliases=["localblacklist"])
|
@commands.group(aliases=["localblacklist"])
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.admin_or_permissions(administrator=True)
|
@commands.admin_or_permissions(administrator=True)
|
||||||
async def localblocklist(self, ctx: commands.Context):
|
async def localblocklist(self, ctx: commands.Context):
|
||||||
"""
|
"""
|
||||||
Commands to manage the server specific blocklist.
|
Commands to manage the server specific blocklist.
|
||||||
@ -5107,13 +5106,13 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await self.bot.clear_blacklist(ctx.guild)
|
await self.bot.clear_blacklist(ctx.guild)
|
||||||
await ctx.send(_("Server blocklist has been cleared."))
|
await ctx.send(_("Server blocklist has been cleared."))
|
||||||
|
|
||||||
@checks.guildowner_or_permissions(administrator=True)
|
@commands.guildowner_or_permissions(administrator=True)
|
||||||
@commands.group(name="command")
|
@commands.group(name="command")
|
||||||
async def command_manager(self, ctx: commands.Context):
|
async def command_manager(self, ctx: commands.Context):
|
||||||
"""Commands to enable and disable commands and cogs."""
|
"""Commands to enable and disable commands and cogs."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
@command_manager.command(name="defaultdisablecog")
|
@command_manager.command(name="defaultdisablecog")
|
||||||
async def command_default_disable_cog(self, ctx: commands.Context, *, cog: CogConverter):
|
async def command_default_disable_cog(self, ctx: commands.Context, *, cog: CogConverter):
|
||||||
"""Set the default state for a cog as disabled.
|
"""Set the default state for a cog as disabled.
|
||||||
@ -5136,7 +5135,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await self.bot._disabled_cog_cache.default_disable(cogname)
|
await self.bot._disabled_cog_cache.default_disable(cogname)
|
||||||
await ctx.send(_("{cogname} has been set as disabled by default.").format(cogname=cogname))
|
await ctx.send(_("{cogname} has been set as disabled by default.").format(cogname=cogname))
|
||||||
|
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
@command_manager.command(name="defaultenablecog")
|
@command_manager.command(name="defaultenablecog")
|
||||||
async def command_default_enable_cog(self, ctx: commands.Context, *, cog: CogConverter):
|
async def command_default_enable_cog(self, ctx: commands.Context, *, cog: CogConverter):
|
||||||
"""Set the default state for a cog as enabled.
|
"""Set the default state for a cog as enabled.
|
||||||
@ -5312,7 +5311,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
else:
|
else:
|
||||||
await ctx.invoke(self.command_disable_guild, command=command)
|
await ctx.invoke(self.command_disable_guild, command=command)
|
||||||
|
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
@command_disable.command(name="global")
|
@command_disable.command(name="global")
|
||||||
async def command_disable_global(self, ctx: commands.Context, *, command: CommandConverter):
|
async def command_disable_global(self, ctx: commands.Context, *, command: CommandConverter):
|
||||||
"""
|
"""
|
||||||
@ -5461,7 +5460,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
else:
|
else:
|
||||||
await ctx.tick()
|
await ctx.tick()
|
||||||
|
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
@command_manager.command(name="disabledmsg")
|
@command_manager.command(name="disabledmsg")
|
||||||
async def command_disabledmsg(self, ctx: commands.Context, *, message: str = ""):
|
async def command_disabledmsg(self, ctx: commands.Context, *, message: str = ""):
|
||||||
"""Set the bot's response to disabled commands.
|
"""Set the bot's response to disabled commands.
|
||||||
@ -5482,7 +5481,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.tick()
|
await ctx.tick()
|
||||||
|
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.guildowner_or_permissions(manage_guild=True)
|
@commands.guildowner_or_permissions(manage_guild=True)
|
||||||
@commands.group(name="autoimmune")
|
@commands.group(name="autoimmune")
|
||||||
async def autoimmune_group(self, ctx: commands.Context):
|
async def autoimmune_group(self, ctx: commands.Context):
|
||||||
"""
|
"""
|
||||||
@ -5660,7 +5659,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(_("Channel already in ignore list."))
|
await ctx.send(_("Channel already in ignore list."))
|
||||||
|
|
||||||
@ignore.command(name="server", aliases=["guild"])
|
@ignore.command(name="server", aliases=["guild"])
|
||||||
@checks.admin_or_permissions(manage_guild=True)
|
@commands.admin_or_permissions(manage_guild=True)
|
||||||
async def ignore_guild(self, ctx: commands.Context):
|
async def ignore_guild(self, ctx: commands.Context):
|
||||||
"""
|
"""
|
||||||
Ignore commands in this server.
|
Ignore commands in this server.
|
||||||
@ -5716,7 +5715,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
|||||||
await ctx.send(_("That channel is not in the ignore list."))
|
await ctx.send(_("That channel is not in the ignore list."))
|
||||||
|
|
||||||
@unignore.command(name="server", aliases=["guild"])
|
@unignore.command(name="server", aliases=["guild"])
|
||||||
@checks.admin_or_permissions(manage_guild=True)
|
@commands.admin_or_permissions(manage_guild=True)
|
||||||
async def unignore_guild(self, ctx: commands.Context):
|
async def unignore_guild(self, ctx: commands.Context):
|
||||||
"""
|
"""
|
||||||
Remove this server from the ignore list.
|
Remove this server from the ignore list.
|
||||||
|
|||||||
@ -24,7 +24,7 @@ from copy import copy
|
|||||||
|
|
||||||
import discord
|
import discord
|
||||||
|
|
||||||
from . import checks, commands
|
from . import commands
|
||||||
from .commands import NoParseOptional as Optional
|
from .commands import NoParseOptional as Optional
|
||||||
from .i18n import Translator, cog_i18n
|
from .i18n import Translator, cog_i18n
|
||||||
from .utils import chat_formatting
|
from .utils import chat_formatting
|
||||||
@ -124,7 +124,7 @@ class Dev(commands.Cog):
|
|||||||
return env
|
return env
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def debug(self, ctx, *, code):
|
async def debug(self, ctx, *, code):
|
||||||
"""Evaluate a statement of python code.
|
"""Evaluate a statement of python code.
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ class Dev(commands.Cog):
|
|||||||
await ctx.send_interactive(self.get_pages(result), box_lang="py")
|
await ctx.send_interactive(self.get_pages(result), box_lang="py")
|
||||||
|
|
||||||
@commands.command(name="eval")
|
@commands.command(name="eval")
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def _eval(self, ctx, *, body: str):
|
async def _eval(self, ctx, *, body: str):
|
||||||
"""Execute asynchronous code.
|
"""Execute asynchronous code.
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ class Dev(commands.Cog):
|
|||||||
await ctx.send_interactive(self.get_pages(msg), box_lang="py")
|
await ctx.send_interactive(self.get_pages(msg), box_lang="py")
|
||||||
|
|
||||||
@commands.group(invoke_without_command=True)
|
@commands.group(invoke_without_command=True)
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def repl(self, ctx):
|
async def repl(self, ctx):
|
||||||
"""Open an interactive REPL.
|
"""Open an interactive REPL.
|
||||||
|
|
||||||
@ -361,7 +361,7 @@ class Dev(commands.Cog):
|
|||||||
|
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def mock(self, ctx, user: discord.Member, *, command):
|
async def mock(self, ctx, user: discord.Member, *, command):
|
||||||
"""Mock another user invoking a command.
|
"""Mock another user invoking a command.
|
||||||
|
|
||||||
@ -375,7 +375,7 @@ class Dev(commands.Cog):
|
|||||||
|
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@commands.command(name="mockmsg")
|
@commands.command(name="mockmsg")
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def mock_msg(self, ctx, user: discord.Member, *, content: str = ""):
|
async def mock_msg(self, ctx, user: discord.Member, *, content: str = ""):
|
||||||
"""Dispatch a message event as if it were sent by a different user.
|
"""Dispatch a message event as if it were sent by a different user.
|
||||||
|
|
||||||
@ -396,7 +396,7 @@ class Dev(commands.Cog):
|
|||||||
ctx.bot.dispatch("message", msg)
|
ctx.bot.dispatch("message", msg)
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@checks.is_owner()
|
@commands.is_owner()
|
||||||
async def bypasscooldowns(self, ctx, toggle: Optional[bool] = None):
|
async def bypasscooldowns(self, ctx, toggle: Optional[bool] = None):
|
||||||
"""Give bot owners the ability to bypass cooldowns.
|
"""Give bot owners the ability to bypass cooldowns.
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user