mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[V3] Standardize to ctx.send_help() (#1077)
This commit is contained in:
parent
ef6dbee516
commit
32372ea237
@ -9,6 +9,7 @@ from redbot.core.bot import Red
|
|||||||
from redbot.core.i18n import CogI18n
|
from redbot.core.i18n import CogI18n
|
||||||
from redbot.core.utils.mod import slow_deletion, mass_purge
|
from redbot.core.utils.mod import slow_deletion, mass_purge
|
||||||
from redbot.cogs.mod.log import log
|
from redbot.cogs.mod.log import log
|
||||||
|
from redbot.core.context import RedContext
|
||||||
|
|
||||||
_ = CogI18n("Cleanup", __file__)
|
_ = CogI18n("Cleanup", __file__)
|
||||||
|
|
||||||
@ -21,10 +22,10 @@ class Cleanup:
|
|||||||
|
|
||||||
@commands.group()
|
@commands.group()
|
||||||
@checks.mod_or_permissions(manage_messages=True)
|
@checks.mod_or_permissions(manage_messages=True)
|
||||||
async def cleanup(self, ctx: commands.Context):
|
async def cleanup(self, ctx: RedContext):
|
||||||
"""Deletes messages."""
|
"""Deletes messages."""
|
||||||
if ctx.invoked_subcommand is None:
|
if ctx.invoked_subcommand is None:
|
||||||
await self.bot.send_cmd_help(ctx)
|
await ctx.send_help()
|
||||||
|
|
||||||
@cleanup.command()
|
@cleanup.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import discord
|
import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
|
||||||
from redbot.core import checks, Config, modlog
|
from redbot.core import checks, Config, modlog, RedContext
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
from redbot.core.i18n import CogI18n
|
from redbot.core.i18n import CogI18n
|
||||||
from redbot.core.utils.chat_formatting import pagify
|
from redbot.core.utils.chat_formatting import pagify
|
||||||
@ -37,14 +37,14 @@ class Filter:
|
|||||||
@commands.group(name="filter")
|
@commands.group(name="filter")
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.mod_or_permissions(manage_messages=True)
|
@checks.mod_or_permissions(manage_messages=True)
|
||||||
async def _filter(self, ctx: commands.Context):
|
async def _filter(self, ctx: RedContext):
|
||||||
"""Adds/removes words from filter
|
"""Adds/removes words from filter
|
||||||
|
|
||||||
Use double quotes to add/remove sentences
|
Use double quotes to add/remove sentences
|
||||||
Using this command with no subcommands will send
|
Using this command with no subcommands will send
|
||||||
the list of the server's filtered words."""
|
the list of the server's filtered words."""
|
||||||
if ctx.invoked_subcommand is None:
|
if ctx.invoked_subcommand is None:
|
||||||
await self.bot.send_cmd_help(ctx)
|
await ctx.send_help()
|
||||||
server = ctx.guild
|
server = ctx.guild
|
||||||
author = ctx.author
|
author = ctx.author
|
||||||
word_list = await self.settings.guild(server).filter()
|
word_list = await self.settings.guild(server).filter()
|
||||||
|
|||||||
@ -4,7 +4,7 @@ from collections import deque, defaultdict
|
|||||||
import discord
|
import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
|
||||||
from redbot.core import checks, Config, modlog
|
from redbot.core import checks, Config, modlog, RedContext
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
from redbot.core.i18n import CogI18n
|
from redbot.core.i18n import CogI18n
|
||||||
from redbot.core.utils.chat_formatting import box, escape
|
from redbot.core.utils.chat_formatting import box, escape
|
||||||
@ -161,11 +161,11 @@ class Mod:
|
|||||||
@commands.group()
|
@commands.group()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.guildowner_or_permissions(administrator=True)
|
@checks.guildowner_or_permissions(administrator=True)
|
||||||
async def modset(self, ctx: commands.Context):
|
async def modset(self, ctx: RedContext):
|
||||||
"""Manages guild administration settings."""
|
"""Manages guild administration settings."""
|
||||||
if ctx.invoked_subcommand is None:
|
if ctx.invoked_subcommand is None:
|
||||||
guild = ctx.guild
|
guild = ctx.guild
|
||||||
await self.bot.send_cmd_help(ctx)
|
await ctx.send_help()
|
||||||
|
|
||||||
# Display current settings
|
# Display current settings
|
||||||
delete_repeats = await self.settings.guild(guild).delete_repeats()
|
delete_repeats = await self.settings.guild(guild).delete_repeats()
|
||||||
@ -187,7 +187,7 @@ class Mod:
|
|||||||
|
|
||||||
@modset.command()
|
@modset.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def hierarchy(self, ctx: commands.Context):
|
async def hierarchy(self, ctx: RedContext):
|
||||||
"""Toggles role hierarchy check for mods / admins"""
|
"""Toggles role hierarchy check for mods / admins"""
|
||||||
guild = ctx.guild
|
guild = ctx.guild
|
||||||
toggled = await self.settings.guild(guild).respect_hierarchy()
|
toggled = await self.settings.guild(guild).respect_hierarchy()
|
||||||
@ -202,7 +202,7 @@ class Mod:
|
|||||||
|
|
||||||
@modset.command()
|
@modset.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def banmentionspam(self, ctx: commands.Context, max_mentions: int=False):
|
async def banmentionspam(self, ctx: RedContext, max_mentions: int=False):
|
||||||
"""Enables auto ban for messages mentioning X different people
|
"""Enables auto ban for messages mentioning X different people
|
||||||
|
|
||||||
Accepted values: 5 or superior"""
|
Accepted values: 5 or superior"""
|
||||||
@ -220,14 +220,14 @@ class Mod:
|
|||||||
else:
|
else:
|
||||||
cur_setting = await self.settings.guild(guild).ban_mention_spam()
|
cur_setting = await self.settings.guild(guild).ban_mention_spam()
|
||||||
if cur_setting is False:
|
if cur_setting is False:
|
||||||
await self.bot.send_cmd_help(ctx)
|
await ctx.send_help()
|
||||||
return
|
return
|
||||||
await self.settings.guild(guild).ban_mention_spam.set(False)
|
await self.settings.guild(guild).ban_mention_spam.set(False)
|
||||||
await ctx.send(_("Autoban for mention spam disabled."))
|
await ctx.send(_("Autoban for mention spam disabled."))
|
||||||
|
|
||||||
@modset.command()
|
@modset.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def deleterepeats(self, ctx: commands.Context):
|
async def deleterepeats(self, ctx: RedContext):
|
||||||
"""Enables auto deletion of repeated messages"""
|
"""Enables auto deletion of repeated messages"""
|
||||||
guild = ctx.guild
|
guild = ctx.guild
|
||||||
cur_setting = await self.settings.guild(guild).delete_repeats()
|
cur_setting = await self.settings.guild(guild).delete_repeats()
|
||||||
@ -241,7 +241,7 @@ class Mod:
|
|||||||
|
|
||||||
@modset.command()
|
@modset.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def deletedelay(self, ctx: commands.Context, time: int=None):
|
async def deletedelay(self, ctx: RedContext, time: int=None):
|
||||||
"""Sets the delay until the bot removes the command message.
|
"""Sets the delay until the bot removes the command message.
|
||||||
Must be between -1 and 60.
|
Must be between -1 and 60.
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ class Mod:
|
|||||||
|
|
||||||
@modset.command()
|
@modset.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def reinvite(self, ctx: commands.Context):
|
async def reinvite(self, ctx: RedContext):
|
||||||
"""Toggles whether an invite will be sent when a user
|
"""Toggles whether an invite will be sent when a user
|
||||||
is unbanned via [p]unban. If this is True, the bot will
|
is unbanned via [p]unban. If this is True, the bot will
|
||||||
attempt to create and send a single-use invite to the
|
attempt to create and send a single-use invite to the
|
||||||
@ -284,7 +284,7 @@ class Mod:
|
|||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.admin_or_permissions(kick_members=True)
|
@checks.admin_or_permissions(kick_members=True)
|
||||||
async def kick(self, ctx: commands.Context, user: discord.Member, *, reason: str = None):
|
async def kick(self, ctx: RedContext, user: discord.Member, *, reason: str = None):
|
||||||
"""Kicks user.
|
"""Kicks user.
|
||||||
If a reason is specified, it
|
If a reason is specified, it
|
||||||
will be the reason that shows up
|
will be the reason that shows up
|
||||||
@ -324,7 +324,7 @@ class Mod:
|
|||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.admin_or_permissions(ban_members=True)
|
@checks.admin_or_permissions(ban_members=True)
|
||||||
async def ban(self, ctx: commands.Context, user: discord.Member, days: str = None, *, reason: str = None):
|
async def ban(self, ctx: RedContext, user: discord.Member, days: str = None, *, reason: str = None):
|
||||||
"""Bans user and deletes last X days worth of messages.
|
"""Bans user and deletes last X days worth of messages.
|
||||||
|
|
||||||
If days is not a number, it's treated as the first word of the reason.
|
If days is not a number, it's treated as the first word of the reason.
|
||||||
@ -378,7 +378,7 @@ class Mod:
|
|||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.admin_or_permissions(ban_members=True)
|
@checks.admin_or_permissions(ban_members=True)
|
||||||
async def hackban(self, ctx: commands.Context, user_id: int, *, reason: str = None):
|
async def hackban(self, ctx: RedContext, user_id: int, *, reason: str = None):
|
||||||
"""Preemptively bans user from the guild
|
"""Preemptively bans user from the guild
|
||||||
|
|
||||||
A user ID needs to be provided in order to ban
|
A user ID needs to be provided in order to ban
|
||||||
@ -428,7 +428,7 @@ class Mod:
|
|||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.admin_or_permissions(ban_members=True)
|
@checks.admin_or_permissions(ban_members=True)
|
||||||
async def softban(self, ctx: commands.Context, user: discord.Member, *, reason: str = None):
|
async def softban(self, ctx: RedContext, user: discord.Member, *, reason: str = None):
|
||||||
"""Kicks the user, deleting 1 day worth of messages."""
|
"""Kicks the user, deleting 1 day worth of messages."""
|
||||||
guild = ctx.guild
|
guild = ctx.guild
|
||||||
channel = ctx.channel
|
channel = ctx.channel
|
||||||
@ -500,7 +500,7 @@ class Mod:
|
|||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.admin_or_permissions(ban_members=True)
|
@checks.admin_or_permissions(ban_members=True)
|
||||||
@commands.bot_has_permissions(ban_members=True)
|
@commands.bot_has_permissions(ban_members=True)
|
||||||
async def unban(self, ctx: commands.Context, user_id: int, *, reason: str = None):
|
async def unban(self, ctx: RedContext, user_id: int, *, reason: str = None):
|
||||||
"""Unbans the target user. Requires specifying the target user's ID
|
"""Unbans the target user. Requires specifying the target user's ID
|
||||||
(which can be found in the mod log channel (if logging was enabled for
|
(which can be found in the mod log channel (if logging was enabled for
|
||||||
the casetype associated with the command used to ban the user) or (if
|
the casetype associated with the command used to ban the user) or (if
|
||||||
@ -555,7 +555,7 @@ class Mod:
|
|||||||
.format(invite.url))
|
.format(invite.url))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
async def get_invite_for_reinvite(ctx: commands.Context):
|
async def get_invite_for_reinvite(ctx: RedContext):
|
||||||
"""Handles the reinvite logic for getting an invite
|
"""Handles the reinvite logic for getting an invite
|
||||||
to send the newly unbanned user
|
to send the newly unbanned user
|
||||||
:returns: :class:`Invite`"""
|
:returns: :class:`Invite`"""
|
||||||
@ -590,7 +590,7 @@ class Mod:
|
|||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@admin_or_voice_permissions(mute_members=True, deafen_members=True)
|
@admin_or_voice_permissions(mute_members=True, deafen_members=True)
|
||||||
@bot_has_voice_permissions(mute_members=True, deafen_members=True)
|
@bot_has_voice_permissions(mute_members=True, deafen_members=True)
|
||||||
async def voiceban(self, ctx: commands.Context, user: discord.Member, *, reason: str=None):
|
async def voiceban(self, ctx: RedContext, user: discord.Member, *, reason: str=None):
|
||||||
"""Bans the target user from speaking and listening in voice channels in the guild"""
|
"""Bans the target user from speaking and listening in voice channels in the guild"""
|
||||||
user_voice_state = user.voice
|
user_voice_state = user.voice
|
||||||
if user_voice_state is None:
|
if user_voice_state is None:
|
||||||
@ -627,7 +627,7 @@ class Mod:
|
|||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@admin_or_voice_permissions(mute_members=True, deafen_members=True)
|
@admin_or_voice_permissions(mute_members=True, deafen_members=True)
|
||||||
@bot_has_voice_permissions(mute_members=True, deafen_members=True)
|
@bot_has_voice_permissions(mute_members=True, deafen_members=True)
|
||||||
async def voiceunban(self, ctx: commands.Context, user: discord.Member, *, reason: str=None):
|
async def voiceunban(self, ctx: RedContext, user: discord.Member, *, reason: str=None):
|
||||||
"""Unbans the user from speaking/listening in the guild's voice channels"""
|
"""Unbans the user from speaking/listening in the guild's voice channels"""
|
||||||
user_voice_state = user.voice
|
user_voice_state = user.voice
|
||||||
if user_voice_state is None:
|
if user_voice_state is None:
|
||||||
@ -661,7 +661,7 @@ class Mod:
|
|||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.admin_or_permissions(manage_nicknames=True)
|
@checks.admin_or_permissions(manage_nicknames=True)
|
||||||
async def rename(self, ctx: commands.Context, user: discord.Member, *, nickname=""):
|
async def rename(self, ctx: RedContext, user: discord.Member, *, nickname=""):
|
||||||
"""Changes user's nickname
|
"""Changes user's nickname
|
||||||
|
|
||||||
Leaving the nickname empty will remove it."""
|
Leaving the nickname empty will remove it."""
|
||||||
@ -681,16 +681,16 @@ class Mod:
|
|||||||
@commands.group()
|
@commands.group()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.mod_or_permissions(manage_channel=True)
|
@checks.mod_or_permissions(manage_channel=True)
|
||||||
async def mute(self, ctx: commands.Context):
|
async def mute(self, ctx: RedContext):
|
||||||
"""Mutes user in the channel/guild"""
|
"""Mutes user in the channel/guild"""
|
||||||
if ctx.invoked_subcommand is None:
|
if ctx.invoked_subcommand is None:
|
||||||
await self.bot.send_cmd_help(ctx)
|
await ctx.send_help()
|
||||||
|
|
||||||
@mute.command(name="voice")
|
@mute.command(name="voice")
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@mod_or_voice_permissions(mute_members=True)
|
@mod_or_voice_permissions(mute_members=True)
|
||||||
@bot_has_voice_permissions(mute_members=True)
|
@bot_has_voice_permissions(mute_members=True)
|
||||||
async def voice_mute(self, ctx: commands.Context, user: discord.Member,
|
async def voice_mute(self, ctx: RedContext, user: discord.Member,
|
||||||
*, reason: str = None):
|
*, reason: str = None):
|
||||||
"""Mutes the user in a voice channel"""
|
"""Mutes the user in a voice channel"""
|
||||||
user_voice_state = user.voice
|
user_voice_state = user.voice
|
||||||
@ -729,7 +729,7 @@ class Mod:
|
|||||||
@checks.mod_or_permissions(administrator=True)
|
@checks.mod_or_permissions(administrator=True)
|
||||||
@mute.command(name="channel")
|
@mute.command(name="channel")
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def channel_mute(self, ctx: commands.Context, user: discord.Member, *, reason: str = None):
|
async def channel_mute(self, ctx: RedContext, user: discord.Member, *, reason: str = None):
|
||||||
"""Mutes user in the current channel"""
|
"""Mutes user in the current channel"""
|
||||||
author = ctx.message.author
|
author = ctx.message.author
|
||||||
channel = ctx.message.channel
|
channel = ctx.message.channel
|
||||||
@ -757,7 +757,7 @@ class Mod:
|
|||||||
@checks.mod_or_permissions(administrator=True)
|
@checks.mod_or_permissions(administrator=True)
|
||||||
@mute.command(name="guild")
|
@mute.command(name="guild")
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def guild_mute(self, ctx: commands.Context, user: discord.Member, *, reason: str = None):
|
async def guild_mute(self, ctx: RedContext, user: discord.Member, *, reason: str = None):
|
||||||
"""Mutes user in the guild"""
|
"""Mutes user in the guild"""
|
||||||
author = ctx.message.author
|
author = ctx.message.author
|
||||||
guild = ctx.guild
|
guild = ctx.guild
|
||||||
@ -816,18 +816,18 @@ class Mod:
|
|||||||
@commands.group()
|
@commands.group()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.mod_or_permissions(manage_channel=True)
|
@checks.mod_or_permissions(manage_channel=True)
|
||||||
async def unmute(self, ctx: commands.Context):
|
async def unmute(self, ctx: RedContext):
|
||||||
"""Unmutes user in the channel/guild
|
"""Unmutes user in the channel/guild
|
||||||
|
|
||||||
Defaults to channel"""
|
Defaults to channel"""
|
||||||
if ctx.invoked_subcommand is None:
|
if ctx.invoked_subcommand is None:
|
||||||
await self.bot.send_cmd_help(ctx)
|
await ctx.send_help()
|
||||||
|
|
||||||
@unmute.command(name="voice")
|
@unmute.command(name="voice")
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@mod_or_voice_permissions(mute_members=True)
|
@mod_or_voice_permissions(mute_members=True)
|
||||||
@bot_has_voice_permissions(mute_members=True)
|
@bot_has_voice_permissions(mute_members=True)
|
||||||
async def voice_unmute(self, ctx: commands.Context, user: discord.Member, *, reason: str = None):
|
async def voice_unmute(self, ctx: RedContext, user: discord.Member, *, reason: str = None):
|
||||||
"""Unmutes the user in a voice channel"""
|
"""Unmutes the user in a voice channel"""
|
||||||
user_voice_state = user.voice
|
user_voice_state = user.voice
|
||||||
if user_voice_state:
|
if user_voice_state:
|
||||||
@ -861,7 +861,7 @@ class Mod:
|
|||||||
@checks.mod_or_permissions(administrator=True)
|
@checks.mod_or_permissions(administrator=True)
|
||||||
@unmute.command(name="channel")
|
@unmute.command(name="channel")
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def channel_unmute(self, ctx: commands.Context, user: discord.Member, *, reason: str=None):
|
async def channel_unmute(self, ctx: RedContext, user: discord.Member, *, reason: str=None):
|
||||||
"""Unmutes user in the current channel"""
|
"""Unmutes user in the current channel"""
|
||||||
channel = ctx.channel
|
channel = ctx.channel
|
||||||
author = ctx.author
|
author = ctx.author
|
||||||
@ -884,7 +884,7 @@ class Mod:
|
|||||||
@checks.mod_or_permissions(administrator=True)
|
@checks.mod_or_permissions(administrator=True)
|
||||||
@unmute.command(name="guild")
|
@unmute.command(name="guild")
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def guild_unmute(self, ctx: commands.Context, user: discord.Member, *, reason: str=None):
|
async def guild_unmute(self, ctx: RedContext, user: discord.Member, *, reason: str=None):
|
||||||
"""Unmutes user in the guild"""
|
"""Unmutes user in the guild"""
|
||||||
guild = ctx.guild
|
guild = ctx.guild
|
||||||
author = ctx.author
|
author = ctx.author
|
||||||
@ -951,14 +951,14 @@ class Mod:
|
|||||||
@commands.group()
|
@commands.group()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.admin_or_permissions(manage_channels=True)
|
@checks.admin_or_permissions(manage_channels=True)
|
||||||
async def ignore(self, ctx: commands.Context):
|
async def ignore(self, ctx: RedContext):
|
||||||
"""Adds guilds/channels to ignorelist"""
|
"""Adds guilds/channels to ignorelist"""
|
||||||
if ctx.invoked_subcommand is None:
|
if ctx.invoked_subcommand is None:
|
||||||
await self.bot.send_cmd_help(ctx)
|
await ctx.send_help()
|
||||||
await ctx.send(await self.count_ignored())
|
await ctx.send(await self.count_ignored())
|
||||||
|
|
||||||
@ignore.command(name="channel")
|
@ignore.command(name="channel")
|
||||||
async def ignore_channel(self, ctx: commands.Context, channel: discord.TextChannel=None):
|
async def ignore_channel(self, ctx: RedContext, channel: discord.TextChannel=None):
|
||||||
"""Ignores channel
|
"""Ignores channel
|
||||||
|
|
||||||
Defaults to current one"""
|
Defaults to current one"""
|
||||||
@ -972,7 +972,7 @@ class Mod:
|
|||||||
|
|
||||||
@ignore.command(name="guild", aliases=["server"])
|
@ignore.command(name="guild", aliases=["server"])
|
||||||
@commands.has_permissions(manage_guild=True)
|
@commands.has_permissions(manage_guild=True)
|
||||||
async def ignore_guild(self, ctx: commands.Context):
|
async def ignore_guild(self, ctx: RedContext):
|
||||||
"""Ignores current guild"""
|
"""Ignores current guild"""
|
||||||
guild = ctx.guild
|
guild = ctx.guild
|
||||||
if not await self.settings.guild(guild).ignored():
|
if not await self.settings.guild(guild).ignored():
|
||||||
@ -984,14 +984,14 @@ class Mod:
|
|||||||
@commands.group()
|
@commands.group()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@checks.admin_or_permissions(manage_channels=True)
|
@checks.admin_or_permissions(manage_channels=True)
|
||||||
async def unignore(self, ctx: commands.Context):
|
async def unignore(self, ctx: RedContext):
|
||||||
"""Removes guilds/channels from ignorelist"""
|
"""Removes guilds/channels from ignorelist"""
|
||||||
if ctx.invoked_subcommand is None:
|
if ctx.invoked_subcommand is None:
|
||||||
await self.bot.send_cmd_help(ctx)
|
await ctx.send_help()
|
||||||
await ctx.send(await self.count_ignored())
|
await ctx.send(await self.count_ignored())
|
||||||
|
|
||||||
@unignore.command(name="channel")
|
@unignore.command(name="channel")
|
||||||
async def unignore_channel(self, ctx: commands.Context, channel: discord.TextChannel=None):
|
async def unignore_channel(self, ctx: RedContext, channel: discord.TextChannel=None):
|
||||||
"""Removes channel from ignore list
|
"""Removes channel from ignore list
|
||||||
|
|
||||||
Defaults to current one"""
|
Defaults to current one"""
|
||||||
@ -1006,7 +1006,7 @@ class Mod:
|
|||||||
|
|
||||||
@unignore.command(name="guild", aliases=["server"])
|
@unignore.command(name="guild", aliases=["server"])
|
||||||
@commands.has_permissions(manage_guild=True)
|
@commands.has_permissions(manage_guild=True)
|
||||||
async def unignore_guild(self, ctx: commands.Context):
|
async def unignore_guild(self, ctx: RedContext):
|
||||||
"""Removes current guild from ignore list"""
|
"""Removes current guild from ignore list"""
|
||||||
guild = ctx.message.guild
|
guild = ctx.message.guild
|
||||||
if await self.settings.guild(guild).ignored():
|
if await self.settings.guild(guild).ignored():
|
||||||
@ -1046,7 +1046,7 @@ class Mod:
|
|||||||
chann_ignored and not perms.manage_channels)
|
chann_ignored and not perms.manage_channels)
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
async def names(self, ctx: commands.Context, user: discord.Member):
|
async def names(self, ctx: RedContext, user: discord.Member):
|
||||||
"""Show previous names/nicknames of a user"""
|
"""Show previous names/nicknames of a user"""
|
||||||
names = await self.settings.user(user).past_names()
|
names = await self.settings.user(user).past_names()
|
||||||
nicks = await self.settings.member(user).past_nicks()
|
nicks = await self.settings.member(user).past_nicks()
|
||||||
@ -1112,7 +1112,7 @@ class Mod:
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
async def on_command(self, ctx: commands.Context):
|
async def on_command(self, ctx: RedContext):
|
||||||
"""Currently used for:
|
"""Currently used for:
|
||||||
* delete delay"""
|
* delete delay"""
|
||||||
guild = ctx.guild
|
guild = ctx.guild
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import discord
|
import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
|
||||||
from redbot.core import checks, modlog
|
from redbot.core import checks, modlog, RedContext
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
from redbot.core.i18n import CogI18n
|
from redbot.core.i18n import CogI18n
|
||||||
from redbot.core.utils.chat_formatting import box
|
from redbot.core.utils.chat_formatting import box
|
||||||
@ -17,14 +17,14 @@ class ModLog:
|
|||||||
|
|
||||||
@commands.group()
|
@commands.group()
|
||||||
@checks.guildowner_or_permissions(administrator=True)
|
@checks.guildowner_or_permissions(administrator=True)
|
||||||
async def modlogset(self, ctx: commands.Context):
|
async def modlogset(self, ctx: RedContext):
|
||||||
"""Settings for the mod log"""
|
"""Settings for the mod log"""
|
||||||
if ctx.invoked_subcommand is None:
|
if ctx.invoked_subcommand is None:
|
||||||
await self.bot.send_cmd_help(ctx)
|
await ctx.send_help()
|
||||||
|
|
||||||
@modlogset.command()
|
@modlogset.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def modlog(self, ctx: commands.Context, channel: discord.TextChannel = None):
|
async def modlog(self, ctx: RedContext, channel: discord.TextChannel = None):
|
||||||
"""Sets a channel as mod log
|
"""Sets a channel as mod log
|
||||||
|
|
||||||
Leaving the channel parameter empty will deactivate it"""
|
Leaving the channel parameter empty will deactivate it"""
|
||||||
@ -46,20 +46,20 @@ class ModLog:
|
|||||||
try:
|
try:
|
||||||
await modlog.get_modlog_channel(guild)
|
await modlog.get_modlog_channel(guild)
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
await self.bot.send_cmd_help(ctx)
|
await ctx.send_help()
|
||||||
else:
|
else:
|
||||||
await modlog.set_modlog_channel(guild, None)
|
await modlog.set_modlog_channel(guild, None)
|
||||||
await ctx.send(_("Mod log deactivated."))
|
await ctx.send(_("Mod log deactivated."))
|
||||||
|
|
||||||
@modlogset.command(name='cases')
|
@modlogset.command(name='cases')
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def set_cases(self, ctx: commands.Context, action: str = None):
|
async def set_cases(self, ctx: RedContext, action: str = None):
|
||||||
"""Enables or disables case creation for each type of mod action"""
|
"""Enables or disables case creation for each type of mod action"""
|
||||||
guild = ctx.guild
|
guild = ctx.guild
|
||||||
|
|
||||||
if action is None: # No args given
|
if action is None: # No args given
|
||||||
casetypes = await modlog.get_all_casetypes(guild)
|
casetypes = await modlog.get_all_casetypes(guild)
|
||||||
await self.bot.send_cmd_help(ctx)
|
await ctx.send_help()
|
||||||
title = _("Current settings:")
|
title = _("Current settings:")
|
||||||
msg = ""
|
msg = ""
|
||||||
for ct in casetypes:
|
for ct in casetypes:
|
||||||
@ -87,7 +87,7 @@ class ModLog:
|
|||||||
|
|
||||||
@modlogset.command()
|
@modlogset.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def resetcases(self, ctx: commands.Context):
|
async def resetcases(self, ctx: RedContext):
|
||||||
"""Resets modlog's cases"""
|
"""Resets modlog's cases"""
|
||||||
guild = ctx.guild
|
guild = ctx.guild
|
||||||
await modlog.reset_cases(guild)
|
await modlog.reset_cases(guild)
|
||||||
@ -95,7 +95,7 @@ class ModLog:
|
|||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def case(self, ctx: commands.Context, number: int):
|
async def case(self, ctx: RedContext, number: int):
|
||||||
"""Shows the specified case"""
|
"""Shows the specified case"""
|
||||||
try:
|
try:
|
||||||
case = await modlog.get_case(number, ctx.guild, self.bot)
|
case = await modlog.get_case(number, ctx.guild, self.bot)
|
||||||
@ -107,14 +107,14 @@ class ModLog:
|
|||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def reason(self, ctx: commands.Context, case: int, *, reason: str = ""):
|
async def reason(self, ctx: RedContext, case: int, *, reason: str = ""):
|
||||||
"""Lets you specify a reason for mod-log's cases
|
"""Lets you specify a reason for mod-log's cases
|
||||||
Please note that you can only edit cases you are
|
Please note that you can only edit cases you are
|
||||||
the owner of unless you are a mod/admin or the guild owner"""
|
the owner of unless you are a mod/admin or the guild owner"""
|
||||||
author = ctx.author
|
author = ctx.author
|
||||||
guild = ctx.guild
|
guild = ctx.guild
|
||||||
if not reason:
|
if not reason:
|
||||||
await self.bot.send_cmd_help(ctx)
|
await ctx.send_help()
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
case_before = await modlog.get_case(case, guild, self.bot)
|
case_before = await modlog.get_case(case, guild, self.bot)
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import discord
|
import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from redbot.core import Config, checks
|
from redbot.core import Config, checks, RedContext
|
||||||
from redbot.core.utils.chat_formatting import pagify, box
|
from redbot.core.utils.chat_formatting import pagify, box
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
from .streams import TwitchStream, HitboxStream, MixerStream, PicartoStream, TwitchCommunity
|
from .streams import TwitchStream, HitboxStream, MixerStream, PicartoStream, TwitchCommunity
|
||||||
@ -89,21 +89,21 @@ class Streams:
|
|||||||
@checks.mod()
|
@checks.mod()
|
||||||
async def streamalert(self, ctx):
|
async def streamalert(self, ctx):
|
||||||
if ctx.invoked_subcommand is None:
|
if ctx.invoked_subcommand is None:
|
||||||
await ctx.bot.send_cmd_help(ctx)
|
await ctx.send_help()
|
||||||
|
|
||||||
@streamalert.group(name="twitch")
|
@streamalert.group(name="twitch")
|
||||||
async def _twitch(self, ctx):
|
async def _twitch(self, ctx):
|
||||||
"""Twitch stream alerts"""
|
"""Twitch stream alerts"""
|
||||||
if isinstance(ctx.invoked_subcommand, commands.Group):
|
if isinstance(ctx.invoked_subcommand, commands.Group):
|
||||||
await self.bot.send_cmd_help(ctx)
|
await ctx.send_help()
|
||||||
|
|
||||||
@_twitch.command(name="channel")
|
@_twitch.command(name="channel")
|
||||||
async def twitch_alert_channel(self, ctx: commands.Context, channel_name: str):
|
async def twitch_alert_channel(self, ctx: RedContext, channel_name: str):
|
||||||
"""Sets a Twitch stream alert notification in the channel"""
|
"""Sets a Twitch stream alert notification in the channel"""
|
||||||
await self.stream_alert(ctx, TwitchStream, channel_name)
|
await self.stream_alert(ctx, TwitchStream, channel_name)
|
||||||
|
|
||||||
@_twitch.command(name="community")
|
@_twitch.command(name="community")
|
||||||
async def twitch_alert_community(self, ctx: commands.Context, community: str):
|
async def twitch_alert_community(self, ctx: RedContext, community: str):
|
||||||
"""Sets a Twitch stream alert notification in the channel
|
"""Sets a Twitch stream alert notification in the channel
|
||||||
for the specified community."""
|
for the specified community."""
|
||||||
await self.community_alert(ctx, TwitchCommunity, community)
|
await self.community_alert(ctx, TwitchCommunity, community)
|
||||||
@ -204,7 +204,7 @@ class Streams:
|
|||||||
@checks.mod()
|
@checks.mod()
|
||||||
async def streamset(self, ctx):
|
async def streamset(self, ctx):
|
||||||
if ctx.invoked_subcommand is None:
|
if ctx.invoked_subcommand is None:
|
||||||
await ctx.bot.send_cmd_help(ctx)
|
await ctx.send_help()
|
||||||
|
|
||||||
@streamset.command()
|
@streamset.command()
|
||||||
@checks.is_owner()
|
@checks.is_owner()
|
||||||
@ -221,7 +221,7 @@ class Streams:
|
|||||||
"""Sets mentions for stream alerts
|
"""Sets mentions for stream alerts
|
||||||
Types: everyone, here, role, none"""
|
Types: everyone, here, role, none"""
|
||||||
if ctx.invoked_subcommand is None:
|
if ctx.invoked_subcommand is None:
|
||||||
await self.bot.send_cmd_help(ctx)
|
await ctx.send_help()
|
||||||
|
|
||||||
@mention.command()
|
@mention.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
|
|||||||
@ -126,16 +126,6 @@ class RedBase(BotBase, RpcMethodMixin):
|
|||||||
return (not (admin_role or mod_role) or
|
return (not (admin_role or mod_role) or
|
||||||
any(role.id in (mod_role, admin_role) for role in member.roles))
|
any(role.id in (mod_role, admin_role) for role in member.roles))
|
||||||
|
|
||||||
async def send_cmd_help(self, ctx):
|
|
||||||
if ctx.invoked_subcommand:
|
|
||||||
pages = await self.formatter.format_help_for(ctx, ctx.invoked_subcommand)
|
|
||||||
for page in pages:
|
|
||||||
await ctx.send(page)
|
|
||||||
else:
|
|
||||||
pages = await self.formatter.format_help_for(ctx, ctx.command)
|
|
||||||
for page in pages:
|
|
||||||
await ctx.send(page)
|
|
||||||
|
|
||||||
async def get_context(self, message, *, cls=RedContext):
|
async def get_context(self, message, *, cls=RedContext):
|
||||||
return await super().get_context(message, cls=cls)
|
return await super().get_context(message, cls=cls)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user