mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-05 17:02:32 -05:00
Add public positive_int and finite_float converters (#5969)
Co-authored-by: Kreusada <67752638+Kreusada@users.noreply.github.com>
This commit is contained in:
@@ -7,13 +7,13 @@ import discord
|
||||
|
||||
from redbot.core import commands, Config
|
||||
from redbot.core.bot import Red
|
||||
from redbot.core.commands import RawUserIdConverter
|
||||
from redbot.core.commands import positive_int, RawUserIdConverter
|
||||
from redbot.core.i18n import Translator, cog_i18n
|
||||
from redbot.core.utils.chat_formatting import humanize_number
|
||||
from redbot.core.utils.mod import slow_deletion, mass_purge
|
||||
from redbot.core.utils.predicates import MessagePredicate
|
||||
from .checks import check_self_permissions
|
||||
from .converters import PositiveInt, RawMessageIds, positive_int
|
||||
from .converters import RawMessageIds
|
||||
|
||||
_ = Translator("Cleanup", __file__)
|
||||
|
||||
@@ -78,9 +78,9 @@ class Cleanup(commands.Cog):
|
||||
channel: Union[
|
||||
discord.TextChannel, discord.VoiceChannel, discord.DMChannel, discord.Thread
|
||||
],
|
||||
number: Optional[PositiveInt] = None,
|
||||
number: Optional[int] = None,
|
||||
check: Callable[[discord.Message], bool] = lambda x: True,
|
||||
limit: Optional[PositiveInt] = None,
|
||||
limit: Optional[int] = None,
|
||||
before: Union[discord.Message, datetime] = None,
|
||||
after: Union[discord.Message, datetime] = None,
|
||||
delete_pinned: bool = False,
|
||||
@@ -684,9 +684,7 @@ class Cleanup(commands.Cog):
|
||||
@commands.guild_only()
|
||||
@commands.mod_or_permissions(manage_messages=True)
|
||||
@commands.bot_has_permissions(manage_messages=True)
|
||||
async def cleanup_duplicates(
|
||||
self, ctx: commands.Context, number: positive_int = PositiveInt(50)
|
||||
):
|
||||
async def cleanup_duplicates(self, ctx: commands.Context, number: positive_int = 50):
|
||||
"""Deletes duplicate messages in the channel from the last X messages and keeps only one copy.
|
||||
|
||||
Defaults to 50.
|
||||
|
||||
Reference in New Issue
Block a user