mirror of
https://github.com/neoarz/Syntrel.git
synced 2025-12-25 11:40:12 +01:00
chore: ruff formatting
This commit is contained in:
@@ -25,9 +25,13 @@ class Moderation(commands.GroupCog, name="moderation"):
|
||||
embed = discord.Embed(
|
||||
title="Moderation Commands",
|
||||
description="Use `.moderation <subcommand>` or `/moderation <subcommand>`.",
|
||||
color=0x7289DA
|
||||
color=0x7289DA,
|
||||
)
|
||||
embed.add_field(
|
||||
name="Available",
|
||||
value="ban, kick, purge, warnings, archive, hackban, nick, timeout",
|
||||
inline=False,
|
||||
)
|
||||
embed.add_field(name="Available", value="ban, kick, purge, warnings, archive, hackban, nick, timeout", inline=False)
|
||||
await context.send(embed=embed)
|
||||
|
||||
async def _invoke_hybrid(self, context: Context, name: str, **kwargs):
|
||||
@@ -68,15 +72,28 @@ class Moderation(commands.GroupCog, name="moderation"):
|
||||
return results[:25]
|
||||
|
||||
@moderation_group.command(name="ban")
|
||||
async def moderation_group_ban(self, context: Context, user: discord.User, *, reason: str = "Not specified", delete_messages: str = "none"):
|
||||
await self._invoke_hybrid(context, "ban", user=user, reason=reason, delete_messages=delete_messages)
|
||||
async def moderation_group_ban(
|
||||
self,
|
||||
context: Context,
|
||||
user: discord.User,
|
||||
*,
|
||||
reason: str = "Not specified",
|
||||
delete_messages: str = "none",
|
||||
):
|
||||
await self._invoke_hybrid(
|
||||
context, "ban", user=user, reason=reason, delete_messages=delete_messages
|
||||
)
|
||||
|
||||
@moderation_group.command(name="kick")
|
||||
async def moderation_group_kick(self, context: Context, user: discord.User, *, reason: str = "Not specified"):
|
||||
async def moderation_group_kick(
|
||||
self, context: Context, user: discord.User, *, reason: str = "Not specified"
|
||||
):
|
||||
await self._invoke_hybrid(context, "kick", user=user, reason=reason)
|
||||
|
||||
@moderation_group.command(name="purge")
|
||||
async def moderation_group_purge(self, context: Context, amount: int, user: discord.Member = None):
|
||||
async def moderation_group_purge(
|
||||
self, context: Context, amount: int, user: discord.Member = None
|
||||
):
|
||||
await self._invoke_hybrid(context, "purge", amount=amount, user=user)
|
||||
|
||||
@moderation_group.command(name="warnings")
|
||||
@@ -88,45 +105,57 @@ class Moderation(commands.GroupCog, name="moderation"):
|
||||
await self._invoke_hybrid(context, "archive", limit=limit)
|
||||
|
||||
@moderation_group.command(name="hackban")
|
||||
async def moderation_group_hackban(self, context: Context, user_id: str, *, reason: str = "Not specified"):
|
||||
async def moderation_group_hackban(
|
||||
self, context: Context, user_id: str, *, reason: str = "Not specified"
|
||||
):
|
||||
await self._invoke_hybrid(context, "hackban", user_id=user_id, reason=reason)
|
||||
|
||||
@moderation_group.command(name="nick")
|
||||
async def moderation_group_nick(self, context: Context, user: discord.User, *, nickname: str = None):
|
||||
async def moderation_group_nick(
|
||||
self, context: Context, user: discord.User, *, nickname: str = None
|
||||
):
|
||||
await self._invoke_hybrid(context, "nick", user=user, nickname=nickname)
|
||||
|
||||
@moderation_group.command(name="timeout")
|
||||
async def moderation_group_timeout(self, context: Context, user: discord.User, duration: str, *, reason: str = "Not specified"):
|
||||
await self._invoke_hybrid(context, "timeout", user=user, duration=duration, reason=reason)
|
||||
async def moderation_group_timeout(
|
||||
self,
|
||||
context: Context,
|
||||
user: discord.User,
|
||||
duration: str,
|
||||
*,
|
||||
reason: str = "Not specified",
|
||||
):
|
||||
await self._invoke_hybrid(
|
||||
context, "timeout", user=user, duration=duration, reason=reason
|
||||
)
|
||||
|
||||
@commands.check(_require_group_prefix)
|
||||
@commands.hybrid_command(
|
||||
name="ban",
|
||||
description="Bans a user from the server."
|
||||
)
|
||||
async def ban(self, context, user: discord.User, *, reason: str = "Not specified", delete_messages: str = "none"):
|
||||
return await ban_command()(self, context, user=user, reason=reason, delete_messages=delete_messages)
|
||||
@commands.hybrid_command(name="ban", description="Bans a user from the server.")
|
||||
async def ban(
|
||||
self,
|
||||
context,
|
||||
user: discord.User,
|
||||
*,
|
||||
reason: str = "Not specified",
|
||||
delete_messages: str = "none",
|
||||
):
|
||||
return await ban_command()(
|
||||
self, context, user=user, reason=reason, delete_messages=delete_messages
|
||||
)
|
||||
|
||||
@commands.check(_require_group_prefix)
|
||||
@commands.hybrid_command(
|
||||
name="kick",
|
||||
description="Kicks a user from the server."
|
||||
)
|
||||
@commands.hybrid_command(name="kick", description="Kicks a user from the server.")
|
||||
async def kick(self, context, user: discord.User, *, reason: str = "Not specified"):
|
||||
return await kick_command()(self, context, user=user, reason=reason)
|
||||
|
||||
@commands.check(_require_group_prefix)
|
||||
@commands.hybrid_command(
|
||||
name="purge",
|
||||
description="Delete a number of messages."
|
||||
)
|
||||
@commands.hybrid_command(name="purge", description="Delete a number of messages.")
|
||||
async def purge(self, context, amount: int, user: discord.Member = None):
|
||||
return await purge_command()(self, context, amount=amount, user=user)
|
||||
|
||||
@commands.check(_require_group_prefix)
|
||||
@commands.hybrid_command(
|
||||
name="warnings",
|
||||
description="Manage warnings of a user on a server."
|
||||
name="warnings", description="Manage warnings of a user on a server."
|
||||
)
|
||||
async def warnings(self, context):
|
||||
return await warnings_command()(self, context)
|
||||
@@ -134,7 +163,7 @@ class Moderation(commands.GroupCog, name="moderation"):
|
||||
@commands.check(_require_group_prefix)
|
||||
@commands.hybrid_command(
|
||||
name="archive",
|
||||
description="Archives in a text file the last messages with a chosen limit of messages."
|
||||
description="Archives in a text file the last messages with a chosen limit of messages.",
|
||||
)
|
||||
async def archive(self, context, limit: int = 10):
|
||||
return await archive_command()(self, context, limit=limit)
|
||||
@@ -142,23 +171,21 @@ class Moderation(commands.GroupCog, name="moderation"):
|
||||
@commands.check(_require_group_prefix)
|
||||
@commands.hybrid_command(
|
||||
name="hackban",
|
||||
description="Bans a user without the user having to be in the server."
|
||||
description="Bans a user without the user having to be in the server.",
|
||||
)
|
||||
async def hackban(self, context, user_id: str, *, reason: str = "Not specified"):
|
||||
return await hackban_command()(self, context, user_id=user_id, reason=reason)
|
||||
|
||||
@commands.check(_require_group_prefix)
|
||||
@commands.hybrid_command(
|
||||
name="nick",
|
||||
description="Change the nickname of a user on a server."
|
||||
name="nick", description="Change the nickname of a user on a server."
|
||||
)
|
||||
async def nick(self, context, user: discord.User, *, nickname: str = None):
|
||||
return await nick_command()(self, context, user=user, nickname=nickname)
|
||||
|
||||
@commands.check(_require_group_prefix)
|
||||
@commands.hybrid_command(
|
||||
name="timeout",
|
||||
description="Timeout a user for a specified duration."
|
||||
name="timeout", description="Timeout a user for a specified duration."
|
||||
)
|
||||
@app_commands.describe(
|
||||
user="The user that should be timed out.",
|
||||
@@ -166,13 +193,23 @@ class Moderation(commands.GroupCog, name="moderation"):
|
||||
reason="The reason why the user should be timed out.",
|
||||
)
|
||||
@app_commands.autocomplete(duration=timeout_duration_autocomplete)
|
||||
async def timeout(self, context, user: discord.User, duration: str, *, reason: str = "Not specified"):
|
||||
return await timeout_command()(self, context, user=user, duration=duration, reason=reason)
|
||||
async def timeout(
|
||||
self,
|
||||
context,
|
||||
user: discord.User,
|
||||
duration: str,
|
||||
*,
|
||||
reason: str = "Not specified",
|
||||
):
|
||||
return await timeout_command()(
|
||||
self, context, user=user, duration=duration, reason=reason
|
||||
)
|
||||
|
||||
|
||||
async def setup(bot) -> None:
|
||||
cog = Moderation(bot)
|
||||
await bot.add_cog(cog)
|
||||
|
||||
|
||||
bot.logger.info("Loaded extension 'moderation.ban'")
|
||||
bot.logger.info("Loaded extension 'moderation.kick'")
|
||||
bot.logger.info("Loaded extension 'moderation.purge'")
|
||||
|
||||
Reference in New Issue
Block a user