Skip to content
Merged
Changes from 1 commit
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
15 changes: 7 additions & 8 deletions cogs/add_users_to_threads_and_channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,16 @@ async def autocomplete_get_roles(
ctx: "TeXBotAutocompleteContext",
) -> "AbstractSet[discord.OptionChoice] | AbstractSet[str]":
"""Autocomplete callable that generates the set of available selectable roles."""
logger.debug("Roles autocomplete called!")
Comment thread
MattyTheHacker marked this conversation as resolved.
Outdated
try:
logger.debug("Getting main guild...")
Comment thread
MattyTheHacker marked this conversation as resolved.
Outdated
main_guild: discord.Guild = ctx.bot.main_guild
except GuildDoesNotExistError:
logger.debug("Main guild does not exist.")
Comment thread
MattyTheHacker marked this conversation as resolved.
Outdated
return set()

if not ctx.value or ctx.value.startswith("@"):
return {
discord.OptionChoice(name=f"@{role.name}", value=str(role.id))
for role in main_guild.roles
}

logger.debug("Main guild found!")
logger.debug(main_guild.name)
Comment thread
MattyTheHacker marked this conversation as resolved.
Outdated
return {
discord.OptionChoice(name=role.name, value=str(role.id))
for role in main_guild.roles
Expand Down Expand Up @@ -185,7 +184,7 @@ async def on_thread_create(self, thread: discord.Thread) -> None:
)

@discord.slash_command( # type: ignore[no-untyped-call, misc]
name="add_users_to_channel",
name="add-users-to-channel",
description="Adds selected users to a channel or thread.",
)
@discord.option( # type: ignore[no-untyped-call, misc]
Expand Down Expand Up @@ -237,7 +236,7 @@ async def add_user_to_channel( # type: ignore[misc]
)

@discord.slash_command( # type: ignore[no-untyped-call, misc]
name="add_role_to_channel",
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]
Expand Down