Add public positive_int and finite_float converters (#5969)

Co-authored-by: Kreusada <67752638+Kreusada@users.noreply.github.com>
This commit is contained in:
AAA3A
2023-04-17 23:33:44 +02:00
committed by GitHub
parent fa305cb060
commit eafbb06756
8 changed files with 143 additions and 76 deletions

View File

@@ -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.