mirror of
https://github.com/neoarz/Syntrel.git
synced 2025-12-25 03:40:11 +01:00
78 lines
2.8 KiB
Python
78 lines
2.8 KiB
Python
|
|
import discord
|
||
|
|
from discord.ext import commands
|
||
|
|
from discord.ext.commands import Context
|
||
|
|
|
||
|
|
from .ban import ban_command
|
||
|
|
from .kick import kick_command
|
||
|
|
from .purge import purge_command
|
||
|
|
from .warnings import warnings_command
|
||
|
|
from .archive import archive_command
|
||
|
|
from .hackban import hackban_command
|
||
|
|
from .nick import nick_command
|
||
|
|
|
||
|
|
class Moderation(commands.GroupCog, name="moderation"):
|
||
|
|
def __init__(self, bot) -> None:
|
||
|
|
self.bot = bot
|
||
|
|
super().__init__()
|
||
|
|
|
||
|
|
@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="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.hybrid_command(
|
||
|
|
name="purge",
|
||
|
|
description="Delete a number of messages."
|
||
|
|
)
|
||
|
|
async def purge(self, context, amount: int):
|
||
|
|
return await purge_command()(self, context, amount=amount)
|
||
|
|
|
||
|
|
@commands.hybrid_command(
|
||
|
|
name="warnings",
|
||
|
|
description="Manage warnings of a user on a server."
|
||
|
|
)
|
||
|
|
async def warnings(self, context):
|
||
|
|
return await warnings_command()(self, context)
|
||
|
|
|
||
|
|
@commands.hybrid_command(
|
||
|
|
name="archive",
|
||
|
|
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)
|
||
|
|
|
||
|
|
@commands.hybrid_command(
|
||
|
|
name="hackban",
|
||
|
|
description="Bans a user without the user having to be in the server."
|
||
|
|
)
|
||
|
|
async def hackban(self, context, user_id: int, *, reason: str = "Not specified"):
|
||
|
|
return await hackban_command()(self, context, user_id=user_id, reason=reason)
|
||
|
|
|
||
|
|
@commands.hybrid_command(
|
||
|
|
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)
|
||
|
|
|
||
|
|
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'")
|
||
|
|
bot.logger.info("Loaded extension 'moderation.warnings'")
|
||
|
|
bot.logger.info("Loaded extension 'moderation.archive'")
|
||
|
|
bot.logger.info("Loaded extension 'moderation.hackban'")
|
||
|
|
bot.logger.info("Loaded extension 'moderation.nick'")
|