Removed legacy and improved documentation
This commit is contained in:
parent
6060a3df83
commit
9417951f55
@ -29,89 +29,6 @@ class Admin(commands.Cog):
|
||||
def __init__(self, client: HoloBot):
|
||||
self.client: HoloBot = client
|
||||
|
||||
# Disabled because warning functionality is temporarily not needed
|
||||
# @slash_command(
|
||||
# name="warning",
|
||||
# description="Попередити юзера про порушення правил",
|
||||
# guild_ids=[config_get_sync("guild")],
|
||||
# )
|
||||
# @option("user", description="Користувач")
|
||||
# @option("reason", description="Причина")
|
||||
# async def warn_cmd(
|
||||
# self,
|
||||
# ctx: ApplicationContext,
|
||||
# user: User,
|
||||
# reason: str = "Не вказана",
|
||||
# ):
|
||||
# logging.info(f"User {ctx.user.id} warned {user.id} for {reason}")
|
||||
# await ctx.defer()
|
||||
# jav_user = HoloUser(user)
|
||||
# if ctx.user.id in await config_get("admins"):
|
||||
# logging.info(
|
||||
# f"Moderator {guild_name(ctx.user)} warned {guild_name(user)} for {reason} (has {jav_user.warnings} warns)"
|
||||
# )
|
||||
# if jav_user.warnings >= 5:
|
||||
# logging.info(
|
||||
# f"User {guild_name(user)} was banned due to a big amount of warns ({jav_user.warnings})"
|
||||
# )
|
||||
# await user.send(
|
||||
# embed=Embed(
|
||||
# title="Перманентне блокування",
|
||||
# description=f"Вас було заблоковано за неодноразове порушення правил сервера.",
|
||||
# color=Color.fail,
|
||||
# )
|
||||
# )
|
||||
# await user.ban(reason=reason)
|
||||
# elif jav_user.warnings >= 2:
|
||||
# logging.info(
|
||||
# f"User {guild_name(user)} was muted due to a big amount of warns ({jav_user.warnings})"
|
||||
# )
|
||||
# jav_user.warn(reason=reason)
|
||||
# await user.send(
|
||||
# embed=Embed(
|
||||
# title="Тимчасове блокування",
|
||||
# description=f"Причина: `{reason}`\n\nНа вашому рахунку вже {jav_user.warnings} попереджень. Вас було тимчасово заблоковано на **1 годину**.\n\nЯкщо Ви продовжите порушувати правила сервера – згодом Вас заблокують.",
|
||||
# color=0xDED56B,
|
||||
# )
|
||||
# )
|
||||
# await user.timeout_for(timedelta(hours=1), reason=reason)
|
||||
# else:
|
||||
# jav_user.warn()
|
||||
|
||||
# await ctx.respond(
|
||||
# embed=Embed(
|
||||
# title="Попередження",
|
||||
# description=f"{user.mention} Будь ласка, не порушуйте правила. Ви отримали попередження з причини `{reason}`.\n\nЯкщо Ви продовжите порушувати правила – це може призвести до блокування в спільноті.",
|
||||
# color=0xDED56B,
|
||||
# )
|
||||
# )
|
||||
# else:
|
||||
# logging.warning(
|
||||
# f"User {guild_name(ctx.user)} tried to use /warn but permission denied"
|
||||
# )
|
||||
# await ctx.respond(
|
||||
# embed=Embed(
|
||||
# title="Відмовлено в доступі",
|
||||
# description="Здається, це команда лише для модераторів",
|
||||
# color=Color.fail,
|
||||
# )
|
||||
# )
|
||||
# mod_role = ds_utils.get(
|
||||
# ctx.user.guild.roles, id=await config_get("moderators", "roles")
|
||||
# )
|
||||
# admin_chan = ds_utils.get(
|
||||
# ctx.user.guild.channels,
|
||||
# id=await config_get("adminchat", "channels", "text"),
|
||||
# )
|
||||
# await admin_chan.send(
|
||||
# content=f"{mod_role.mention}",
|
||||
# embed=Embed(
|
||||
# title="Неавторизований запит",
|
||||
# description=f"Користувач {ctx.user.mention} запитав у каналі {ctx.channel.mention} команду, до якої не повинен мати доступу/бачити.",
|
||||
# color=Color.fail,
|
||||
# ),
|
||||
# )
|
||||
|
||||
@slash_command(
|
||||
name="clear",
|
||||
description="Видалити деяку кількість повідомлень в каналі",
|
||||
@ -125,6 +42,10 @@ class Admin(commands.Cog):
|
||||
amount: int,
|
||||
user: User,
|
||||
) -> None:
|
||||
"""Command /clear <amount> [<user>]
|
||||
|
||||
Removes last <amount> messages in the current channel. Optionally from a specific user.
|
||||
"""
|
||||
if ctx.user.id in self.client.owner_ids:
|
||||
logging.info(
|
||||
"User %s removed %s message(s) in %s",
|
||||
@ -183,6 +104,10 @@ class Admin(commands.Cog):
|
||||
guild_ids=[config_get("guild")],
|
||||
)
|
||||
async def reboot_cmd(self, ctx: ApplicationContext) -> None:
|
||||
"""Command /reboot
|
||||
|
||||
Stops the bot. Is called "reboot" because it's assumed that the bot has automatic restart.
|
||||
"""
|
||||
await ctx.defer(ephemeral=True)
|
||||
|
||||
if ctx.user.id in self.client.owner_ids:
|
||||
|
@ -16,11 +16,13 @@ class Analytics(commands.Cog):
|
||||
|
||||
@Cog.listener()
|
||||
async def on_message(self, message: Message) -> None:
|
||||
"""Listener that collects analytical data (stickers, attachments, messages)."""
|
||||
if (
|
||||
(message.author != self.client.user)
|
||||
and (message.author.bot is False)
|
||||
and (message.author.system is False)
|
||||
):
|
||||
# Handle stickers
|
||||
stickers: List[Dict[str, Any]] = []
|
||||
|
||||
for sticker in message.stickers:
|
||||
@ -33,6 +35,7 @@ class Analytics(commands.Cog):
|
||||
}
|
||||
)
|
||||
|
||||
# Handle attachments
|
||||
attachments: List[Dict[str, Any]] = []
|
||||
|
||||
for attachment in message.attachments:
|
||||
@ -49,6 +52,7 @@ class Analytics(commands.Cog):
|
||||
}
|
||||
)
|
||||
|
||||
# Insert entry into the database
|
||||
await col_analytics.insert_one(
|
||||
{
|
||||
"user": message.author.id,
|
||||
|
@ -42,6 +42,10 @@ class CustomChannels(commands.Cog):
|
||||
async def custom_channel_get_cmd(
|
||||
self, ctx: ApplicationContext, name: str, reactions: bool, threads: bool
|
||||
) -> None:
|
||||
"""Command /customchannel get <name> <reactions> <threads>
|
||||
|
||||
Command to create a custom channel for a user.
|
||||
"""
|
||||
holo_user_ctx: HoloUser = HoloUser(ctx.user)
|
||||
|
||||
# Return if the user is using the command outside of a guild
|
||||
@ -127,6 +131,10 @@ class CustomChannels(commands.Cog):
|
||||
async def custom_channel_edit_cmd(
|
||||
self, ctx: ApplicationContext, name: str, reactions: bool, threads: bool
|
||||
) -> None:
|
||||
"""Command /customchannel edit <name> <reactions> <threads>
|
||||
|
||||
Command to change properties of a custom channel.
|
||||
"""
|
||||
holo_user_ctx: HoloUser = HoloUser(ctx.user)
|
||||
|
||||
custom_channel: TextChannel | None = ds_utils.get(
|
||||
@ -170,6 +178,9 @@ class CustomChannels(commands.Cog):
|
||||
async def custom_channel_remove_cmd(
|
||||
self, ctx: ApplicationContext, confirm: bool = False
|
||||
) -> None:
|
||||
"""Command /customchannel remove [<confirm>]
|
||||
|
||||
Command to remove a custom channel. Requires additional confirmation."""
|
||||
holo_user_ctx: HoloUser = HoloUser(ctx.user)
|
||||
|
||||
# Return if the user does not have a custom channel
|
||||
|
@ -35,6 +35,9 @@ class Data(commands.Cog):
|
||||
"kind", description="Тип даних, які треба експортувати", choices=["Користувачі"]
|
||||
)
|
||||
async def data_export_cmd(self, ctx: ApplicationContext, kind: str) -> None:
|
||||
"""Command /data export <kind>
|
||||
|
||||
Command to export specific kind of data."""
|
||||
await ctx.defer()
|
||||
|
||||
# Return if the user is not an owner and not in the council
|
||||
@ -107,6 +110,11 @@ class Data(commands.Cog):
|
||||
"kind", description="Тип даних, які треба експортувати", choices=["Користувачі"]
|
||||
)
|
||||
async def data_migrate_cmd(self, ctx: ApplicationContext, kind: str) -> None:
|
||||
"""Command /migrate <kind>
|
||||
|
||||
Command to migrate specific kind of data.
|
||||
|
||||
Migration of users in this case means creation of their DB entries."""
|
||||
await ctx.defer()
|
||||
|
||||
# Return if the user is not an owner and not in the council
|
||||
|
@ -27,6 +27,9 @@ class Fun(commands.Cog):
|
||||
)
|
||||
@option("user", description="Користувач")
|
||||
async def action_cmd(self, ctx: ApplicationContext, type: str, user: User) -> None:
|
||||
"""Command /action <type> <user>
|
||||
|
||||
Command to perform some RP action on a user and send them a GIF."""
|
||||
await ctx.defer()
|
||||
|
||||
action: str = await config_get("category", "actions", type)
|
||||
|
@ -18,6 +18,7 @@ class Logger(commands.Cog):
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_message(self, message: Message):
|
||||
"""Message listener. All actions on messages remain here for now."""
|
||||
if (
|
||||
(message.author != self.client.user)
|
||||
and (message.author.bot is False)
|
||||
@ -46,6 +47,7 @@ class Logger(commands.Cog):
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_member_join(self, member: Member) -> None:
|
||||
"""Member join handler. All actions on member join remain here for now."""
|
||||
welcome_chan: TextChannel | None = ds_utils.get(
|
||||
self.client.get_guild(await config_get("guild")).channels,
|
||||
id=await config_get("welcome", "channels", "text"),
|
||||
|
@ -16,6 +16,7 @@ class Utility(commands.Cog):
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_ready(self) -> None:
|
||||
"""Listener for the event when bot connects to Discord and becomes "ready"."""
|
||||
logger.info("Logged in as %s", self.client.user)
|
||||
|
||||
activity_type: str = await config_get("type", "status")
|
||||
|
Loading…
Reference in New Issue
Block a user