diff options
| author | 2019-12-23 11:37:50 -0800 | |
|---|---|---|
| committer | 2019-12-23 11:37:50 -0800 | |
| commit | 35207f5b05e244b88c1c3cf02cd8385152821104 (patch) | |
| tree | 855e854a274c2c98a939976b087bf9b55b246a9a | |
| parent | Refactor user type aliases (diff) | |
Move Expiry converter alias to converters.py
| -rw-r--r-- | bot/cogs/moderation/infractions.py | 10 | ||||
| -rw-r--r-- | bot/cogs/moderation/management.py | 4 | ||||
| -rw-r--r-- | bot/cogs/moderation/superstarify.py | 3 | ||||
| -rw-r--r-- | bot/cogs/moderation/utils.py | 2 | ||||
| -rw-r--r-- | bot/converters.py | 1 |
5 files changed, 10 insertions, 10 deletions
diff --git a/bot/cogs/moderation/infractions.py b/bot/cogs/moderation/infractions.py index d7201bdb1..f4159adb9 100644 --- a/bot/cogs/moderation/infractions.py +++ b/bot/cogs/moderation/infractions.py @@ -9,7 +9,7 @@ from discord.ext.commands import Context, command from bot import constants from bot.bot import Bot from bot.constants import Event -from bot.converters import FetchedMember +from bot.converters import Expiry, FetchedMember from bot.decorators import respect_role_hierarchy from bot.utils.checks import with_role_check from . import utils @@ -74,7 +74,7 @@ class Infractions(InfractionScheduler, commands.Cog): # region: Temporary infractions @command(aliases=["mute"]) - async def tempmute(self, ctx: Context, user: Member, duration: utils.Expiry, *, reason: str = None) -> None: + async def tempmute(self, ctx: Context, user: Member, duration: Expiry, *, reason: str = None) -> None: """ Temporarily mute a user for the given reason and duration. @@ -93,7 +93,7 @@ class Infractions(InfractionScheduler, commands.Cog): await self.apply_mute(ctx, user, reason, expires_at=duration) @command() - async def tempban(self, ctx: Context, user: FetchedMember, duration: utils.Expiry, *, reason: str = None) -> None: + async def tempban(self, ctx: Context, user: FetchedMember, duration: Expiry, *, reason: str = None) -> None: """ Temporarily ban a user for the given reason and duration. @@ -137,7 +137,7 @@ class Infractions(InfractionScheduler, commands.Cog): # region: Temporary shadow infractions @command(hidden=True, aliases=["shadowtempmute, stempmute", "shadowmute", "smute"]) - async def shadow_tempmute(self, ctx: Context, user: Member, duration: utils.Expiry, *, reason: str = None) -> None: + async def shadow_tempmute(self, ctx: Context, user: Member, duration: Expiry, *, reason: str = None) -> None: """ Temporarily mute a user for the given reason and duration without notifying the user. @@ -160,7 +160,7 @@ class Infractions(InfractionScheduler, commands.Cog): self, ctx: Context, user: FetchedMember, - duration: utils.Expiry, + duration: Expiry, *, reason: str = None ) -> None: diff --git a/bot/cogs/moderation/management.py b/bot/cogs/moderation/management.py index 2ec69960e..0636422d3 100644 --- a/bot/cogs/moderation/management.py +++ b/bot/cogs/moderation/management.py @@ -10,7 +10,7 @@ from discord.ext.commands import Context from bot import constants from bot.bot import Bot -from bot.converters import InfractionSearchQuery, allowed_strings, proxy_user +from bot.converters import Expiry, InfractionSearchQuery, allowed_strings, proxy_user from bot.pagination import LinePaginator from bot.utils import time from bot.utils.checks import in_channel_check, with_role_check @@ -51,7 +51,7 @@ class ModManagement(commands.Cog): self, ctx: Context, infraction_id: t.Union[int, allowed_strings("l", "last", "recent")], - duration: t.Union[utils.Expiry, allowed_strings("p", "permanent"), None], + duration: t.Union[Expiry, allowed_strings("p", "permanent"), None], *, reason: str = None ) -> None: diff --git a/bot/cogs/moderation/superstarify.py b/bot/cogs/moderation/superstarify.py index 7631d9bbe..be1e7b2d9 100644 --- a/bot/cogs/moderation/superstarify.py +++ b/bot/cogs/moderation/superstarify.py @@ -10,6 +10,7 @@ from discord.ext.commands import Cog, Context, command from bot import constants from bot.bot import Bot +from bot.converters import Expiry from bot.utils.checks import with_role_check from bot.utils.time import format_infraction from . import utils @@ -107,7 +108,7 @@ class Superstarify(InfractionScheduler, Cog): self, ctx: Context, member: Member, - duration: utils.Expiry, + duration: Expiry, reason: str = None ) -> None: """ diff --git a/bot/cogs/moderation/utils.py b/bot/cogs/moderation/utils.py index 79555369c..5052b9048 100644 --- a/bot/cogs/moderation/utils.py +++ b/bot/cogs/moderation/utils.py @@ -8,7 +8,6 @@ from discord.ext.commands import Context from bot.api import ResponseCodeError from bot.constants import Colours, Icons -from bot.converters import Duration, ISODateTime log = logging.getLogger(__name__) @@ -28,7 +27,6 @@ APPEALABLE_INFRACTIONS = ("ban", "mute") UserObject = t.Union[discord.Member, discord.User] UserSnowflake = t.Union[UserObject, discord.Object] Infraction = t.Dict[str, t.Union[str, int, bool]] -Expiry = t.Union[Duration, ISODateTime] async def post_user(ctx: Context, user: UserSnowflake) -> t.Optional[dict]: diff --git a/bot/converters.py b/bot/converters.py index be972086d..cca57a02d 100644 --- a/bot/converters.py +++ b/bot/converters.py @@ -348,4 +348,5 @@ class FetchedUser(UserConverter): raise BadArgument(f"User `{arg}` does not exist") +Expiry = t.Union[Duration, ISODateTime] FetchedMember = t.Union[discord.Member, FetchedUser] |