Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions cogs/add_users_to_threads_and_channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ async def add_users_or_roles_with_ping(
@capture_guild_does_not_exist_error
async def on_thread_create(self, thread: discord.Thread) -> None:
"""Add users to a thread when it is created."""
# NOTE: Shortcut accessors are placed at the top of the function, so that the exceptions they raise are displayed before any further errors may be sent
# NOTE: Shortcut accessors are placed at the top of the function so that the exceptions they raise are displayed before any further errors may be sent
committee_role: discord.Role = await self.bot.committee_role
committee_elect_role: discord.Role = await self.bot.committee_elect_role

Expand All @@ -183,18 +183,18 @@ async def on_thread_create(self, thread: discord.Thread) -> None:
users_or_roles=(committee_role, committee_elect_role), channel_or_thread=thread
)

@discord.slash_command( # type: ignore[no-untyped-call, misc]
@discord.slash_command(
name="add-users-to-channel", description="Adds selected users to a channel or thread."
)
@discord.option( # type: ignore[no-untyped-call, misc]
@discord.option(
name="user",
description="The user to add to the channel.",
input_type=str,
autocomplete=discord.utils.basic_autocomplete(autocomplete_get_members), # type: ignore[arg-type]
required=True,
parameter_name="user_id_str",
)
@discord.option( # type: ignore[no-untyped-call, misc]
@discord.option(
name="silent",
description="Whether the users being added should be pinged or not.",
input_type=bool,
Expand All @@ -203,7 +203,7 @@ async def on_thread_create(self, thread: discord.Thread) -> None:
)
@CommandChecks.check_interaction_user_has_committee_role
@CommandChecks.check_interaction_user_in_main_guild
async def add_user_to_channel( # type: ignore[misc]
async def add_user_to_channel(
self,
ctx: "TeXBotApplicationContext",
user_id_str: str,
Expand Down Expand Up @@ -237,19 +237,19 @@ async def add_user_to_channel( # type: ignore[misc]
ephemeral=True,
)

@discord.slash_command( # type: ignore[no-untyped-call, misc]
@discord.slash_command(
name="add-role-to-channel",
description="Adds the selected role and it's users to a channel or thread.",
)
@discord.option( # type: ignore[no-untyped-call, misc]
@discord.option(
name="role",
description="The role to add to the channel.",
input_type=str,
autocomplete=discord.utils.basic_autocomplete(autocomplete_get_roles), # type: ignore[arg-type]
required=True,
parameter_name="role_id_str",
)
@discord.option( # type: ignore[no-untyped-call, misc]
@discord.option(
name="silent",
description="Whether the users being added should be pinged or not.",
input_type=bool,
Expand All @@ -258,7 +258,7 @@ async def add_user_to_channel( # type: ignore[misc]
)
@CommandChecks.check_interaction_user_has_committee_role
@CommandChecks.check_interaction_user_in_main_guild
async def add_role_to_channel( # type: ignore[misc]
async def add_role_to_channel(
self,
ctx: "TeXBotApplicationContext",
role_id_str: str,
Expand Down
18 changes: 9 additions & 9 deletions cogs/annual_handover_and_reset.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
class CommitteeHandoverCommandCog(TeXBotBaseCog):
"""Cog class that defines the "/committee-handover" command."""

@discord.slash_command( # type: ignore[no-untyped-call, misc]
@discord.slash_command(
name="committee-handover",
description="Initiates the annual Discord handover procedure for new committee.",
)
@CommandChecks.check_interaction_user_has_committee_role
@CommandChecks.check_interaction_user_in_main_guild
async def committee_handover(self, ctx: "TeXBotApplicationContext") -> None: # type: ignore[misc]
async def committee_handover(self, ctx: "TeXBotApplicationContext") -> None:
"""
Definition & callback response of the "committee_handover" command.

Expand All @@ -48,7 +48,7 @@ async def committee_handover(self, ctx: "TeXBotApplicationContext") -> None: #

To do this, TeX-Bot will need to hold a role above that of the "Committee" role.
"""
# NOTE: Shortcut accessors are placed at the top of the function, so that the exceptions they raise are displayed before any further errors may be sent
# NOTE: Shortcut accessors are placed at the top of the function so that the exceptions they raise are displayed before any further errors may be sent
main_guild: discord.Guild = self.bot.main_guild
committee_role: discord.Role = await self.bot.committee_role
committee_elect_role: discord.Role = await self.bot.committee_elect_role
Expand Down Expand Up @@ -177,21 +177,21 @@ class AnnualRolesResetCommandCog(TeXBotBaseCog):
}
)

@discord.slash_command( # type: ignore[no-untyped-call, misc]
@discord.slash_command(
name="annual-roles-reset",
description="Removes the @Member role and academic year roles from all users.",
)
@CommandChecks.check_interaction_user_has_committee_role
@CommandChecks.check_interaction_user_in_main_guild
async def annual_roles_reset(self, ctx: "TeXBotApplicationContext") -> None: # type: ignore[misc]
async def annual_roles_reset(self, ctx: "TeXBotApplicationContext") -> None:
"""
Definition & callback response of the "annual_roles_reset" command.

The "annual_roles_reset" command removes the "Member" and academic year roles
from any user that has them and subsequently deletes all instances of
the GroupMadeMember database model.
"""
# NOTE: Shortcut accessors are placed at the top of the function, so that the exceptions they raise are displayed before any further errors may be sent
# NOTE: Shortcut accessors are placed at the top of the function so that the exceptions they raise are displayed before any further errors may be sent
main_guild: discord.Guild = self.bot.main_guild
member_role: discord.Role = await self.bot.member_role

Expand Down Expand Up @@ -266,13 +266,13 @@ async def annual_roles_reset(self, ctx: "TeXBotApplicationContext") -> None: #
class AnnualYearChannelsIncrementCommandCog(TeXBotBaseCog):
"""Cog class that defines the "/increment-year-channels" command."""

@discord.slash_command( # type: ignore[no-untyped-call, misc]
@discord.slash_command(
name="increment-year-channels",
description="Increments the year channels, archiving and creating channels as needed.",
)
@CommandChecks.check_interaction_user_has_committee_role
@CommandChecks.check_interaction_user_in_main_guild
async def increment_year_channels(self, ctx: "TeXBotApplicationContext") -> None: # type: ignore[misc]
async def increment_year_channels(self, ctx: "TeXBotApplicationContext") -> None:
"""
Definition and callback response of the "increment_year_channels" command.

Expand All @@ -282,7 +282,7 @@ async def increment_year_channels(self, ctx: "TeXBotApplicationContext") -> None
- Renames the current "first-years" channel to "second-years"
- Creates a new "first-years" channel
"""
# NOTE: Shortcut accessors are placed at the top of the function, so that the exceptions they raise are displayed before any further errors may be sent
# NOTE: Shortcut accessors are placed at the top of the function so that the exceptions they raise are displayed before any further errors may be sent
main_guild: discord.Guild = self.bot.main_guild
guest_role: discord.Role = await self.bot.guest_role
INCREMENT_YEAR_CHANNELS_AUDIT_MESSAGE: Final[str] = (
Expand Down
20 changes: 10 additions & 10 deletions cogs/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ async def autocomplete_get_non_archived_channels(
)
}

@discord.slash_command( # type: ignore[no-untyped-call, misc]
@discord.slash_command(
name="archive-category", description="Archives the selected category."
)
@discord.option( # type: ignore[no-untyped-call, misc]
@discord.option(
name="category",
description="The category to archive.",
input_type=str,
Expand All @@ -110,7 +110,7 @@ async def autocomplete_get_non_archived_channels(
required=True,
parameter_name="str_category_id",
)
@discord.option( # type: ignore[no-untyped-call, misc]
@discord.option(
name="allow-archivist-access",
description="Whether to allow archivists to access the category.",
input_type=bool,
Expand All @@ -119,7 +119,7 @@ async def autocomplete_get_non_archived_channels(
)
@CommandChecks.check_interaction_user_has_committee_role
@CommandChecks.check_interaction_user_in_main_guild
async def archive_category( # type: ignore[misc]
async def archive_category(
self,
ctx: "TeXBotApplicationContext",
str_category_id: str,
Expand All @@ -132,7 +132,7 @@ async def archive_category( # type: ignore[misc]
have the "Archivist" role. This can be overridden via a boolean parameter to allow
for committee channels to be archived with the same command but not be visible.
"""
# NOTE: Shortcut accessors are placed at the top of the function, so that the exceptions they raise are displayed before any further errors may be sent
# NOTE: Shortcut accessors are placed at the top of the function so that the exceptions they raise are displayed before any further errors may be sent
main_guild: discord.Guild = self.bot.main_guild
archivist_role: discord.Role = await self.bot.archivist_role

Expand Down Expand Up @@ -190,18 +190,18 @@ async def archive_category( # type: ignore[misc]
content=f":white_check_mark: Category '{category.name}' successfully archived."
)

@discord.slash_command( # type: ignore[no-untyped-call, misc]
@discord.slash_command(
name="archive-channel", description="Archives the selected channel."
)
@discord.option( # type: ignore[no-untyped-call, misc]
@discord.option(
name="channel",
description="The channel to archive.",
input_type=str,
autocomplete=discord.utils.basic_autocomplete(autocomplete_get_non_archived_channels), # type: ignore[arg-type]
required=True,
parameter_name="str_channel_id",
)
@discord.option( # type: ignore[no-untyped-call, misc]
@discord.option(
name="category",
description="The category to move the channel to.",
input_type=str,
Expand All @@ -211,7 +211,7 @@ async def archive_category( # type: ignore[misc]
)
@CommandChecks.check_interaction_user_has_committee_role
@CommandChecks.check_interaction_user_in_main_guild
async def archive_channel( # type: ignore[misc]
async def archive_channel(
self, ctx: "TeXBotApplicationContext", str_channel_id: str, str_category_id: str
) -> None:
"""
Expand All @@ -220,7 +220,7 @@ async def archive_channel( # type: ignore[misc]
The "archive-channel" command moves the channel into the selected category
and syncs the permissions to the category's permissions.
"""
# NOTE: Shortcut accessors are placed at the top of the function, so that the exceptions they raise are displayed before any further errors may be sent
# NOTE: Shortcut accessors are placed at the top of the function so that the exceptions they raise are displayed before any further errors may be sent
main_guild: discord.Guild = self.bot.main_guild

if not re.fullmatch(r"\A\d{17,20}\Z", str_channel_id):
Expand Down
4 changes: 2 additions & 2 deletions cogs/check_su_platform_authorisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,13 @@ async def get_su_platform_organisations(self) -> "Iterable[str]":
class CheckSUPlatformAuthorisationCommandCog(CheckSUPlatformAuthorisationBaseCog):
"""Cog class that defines the "/check-su-platform-authorisation" command."""

@discord.slash_command( # type: ignore[no-untyped-call, misc]
@discord.slash_command(
name="check-su-platform-authorisation",
description="Checks the authorisation held by the SU platform access cookie.",
)
@CommandChecks.check_interaction_user_has_committee_role
@CommandChecks.check_interaction_user_in_main_guild
async def check_su_platform_authorisation(self, ctx: "TeXBotApplicationContext") -> None: # type: ignore[misc]
async def check_su_platform_authorisation(self, ctx: "TeXBotApplicationContext") -> None:
"""
Definition of the "check_su_platform_authorisation" command.

Expand Down
36 changes: 18 additions & 18 deletions cogs/committee_actions_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,14 @@ async def autocomplete_get_action_status(
@committee_actions.command(
name="create", description="Adds a new action with the specified description."
)
@discord.option( # type: ignore[no-untyped-call, misc]
@discord.option(
name="description",
description="The description of the action to assign.",
input_type=str,
required=True,
parameter_name="action_description",
)
@discord.option( # type: ignore[no-untyped-call, misc]
@discord.option(
name="user",
description="The user to assign the action to.",
input_type=str,
Expand Down Expand Up @@ -266,15 +266,15 @@ async def create(
@committee_actions.command(
name="update-status", description="Update the status of the provided action."
)
@discord.option( # type: ignore[no-untyped-call, misc]
@discord.option(
name="action",
description="The action to mark as completed.",
input_type=str,
autocomplete=discord.utils.basic_autocomplete(autocomplete_get_user_action_ids), # type: ignore[arg-type]
required=True,
parameter_name="action_id",
)
@discord.option( # type: ignore[no-untyped-call, misc]
@discord.option(
name="status",
description="The desired status of the action.",
input_type=str,
Expand Down Expand Up @@ -338,15 +338,15 @@ async def update_status( # NOTE: Committee role check is not present because no
@committee_actions.command(
name="update-description", description="Update the description of the provided action."
)
@discord.option( # type: ignore[no-untyped-call, misc]
@discord.option(
name="action",
description="The action to mark as completed.",
input_type=str,
autocomplete=discord.utils.basic_autocomplete(autocomplete_get_user_action_ids), # type: ignore[arg-type]
required=True,
parameter_name="action_id",
)
@discord.option( # type: ignore[no-untyped-call, misc]
@discord.option(
name="description",
description="The description to be used for the action",
input_type=str,
Expand Down Expand Up @@ -400,7 +400,7 @@ async def update_description(
name="action-random-user",
description="Creates an action object with the specified description and random user.",
)
@discord.option( # type: ignore[no-untyped-call, misc]
@discord.option(
name="description",
description="The description to be used for the action",
input_type=str,
Expand Down Expand Up @@ -463,7 +463,7 @@ async def action_random_user(
name="action-all-committee",
description="Creates an action with the description for every committee member",
)
@discord.option( # type: ignore[no-untyped-call, misc]
@discord.option(
name="description",
description="The description to be used for the actions",
input_type=str,
Expand Down Expand Up @@ -528,7 +528,7 @@ async def action_all_committee(
@committee_actions.command(
name="list", description="Lists all actions for a specified user"
)
@discord.option( # type: ignore[no-untyped-call, misc]
@discord.option(
name="user",
description="The user to list actions for.",
input_type=str,
Expand All @@ -537,14 +537,14 @@ async def action_all_committee(
default=None,
parameter_name="action_member_id",
)
@discord.option( # type: ignore[no-untyped-call, misc]
@discord.option(
name="ping",
description="Triggers whether the message pings users or not.",
input_type=bool,
default=False,
required=False,
)
@discord.option( # type: ignore[no-untyped-call, misc]
@discord.option(
name="status",
description="The desired status of the action.",
input_type=str,
Expand Down Expand Up @@ -647,15 +647,15 @@ async def list_user_actions( # NOTE: Committee role check is not present becaus
@committee_actions.command(
name="reassign", description="Reassign the specified action to another user."
)
@discord.option( # type: ignore[no-untyped-call, misc]
@discord.option(
name="action",
description="The action to reassign.",
input_type=str,
autocomplete=discord.utils.basic_autocomplete(autocomplete_get_user_action_ids), # type: ignore[arg-type]
required=True,
parameter_name="action_id",
)
@discord.option( # type: ignore[no-untyped-call, misc]
@discord.option(
name="user",
description="The user to list actions for.",
input_type=str,
Expand Down Expand Up @@ -724,14 +724,14 @@ async def reassign_action(
return

@committee_actions.command(name="list-all", description="List all current actions.")
@discord.option( # type: ignore[no-untyped-call, misc]
@discord.option(
name="ping",
description="Triggers whether the message pings users or not.",
input_type=bool,
default=False,
required=False,
)
@discord.option( # type: ignore[no-untyped-call, misc]
@discord.option(
name="status-filter",
description="The filter to apply to the status of actions.",
input_type=str,
Expand Down Expand Up @@ -795,7 +795,7 @@ async def list_all_actions(
@committee_actions.command(
name="delete", description="Deletes the specified action from the database completely."
)
@discord.option( # type: ignore[no-untyped-call, misc]
@discord.option(
name="action",
description="The action to delete.",
input_type=str,
Expand Down Expand Up @@ -841,13 +841,13 @@ async def delete_action(self, ctx: "TeXBotApplicationContext", action_id: str) -
class CommitteeActionsTrackingContextCommandsCog(CommitteeActionsTrackingBaseCog):
"""Cog class to define the actions tracking message context commands."""

@discord.message_command( # type: ignore[no-untyped-call, misc]
@discord.message_command(
name="Action Message Author",
description="Creates a new action for the message author using the message content.",
)
@CommandChecks.check_interaction_user_has_committee_role
@CommandChecks.check_interaction_user_in_main_guild
async def action_message_author( # type: ignore[misc]
async def action_message_author(
self, ctx: "TeXBotApplicationContext", message: discord.Message
) -> None:
"""
Expand Down
Loading