Compare commits
No commits in common. "1fc5ef76a6c66b3ac456eafd004e5e77d15d8d3e" and "9db00516c3590e3176f2a673f52eee3141425607" have entirely different histories.
1fc5ef76a6
...
9db00516c3
@ -25,8 +25,8 @@ class ModuleList:
|
|||||||
[
|
[
|
||||||
CoreModule, # has to be first!
|
CoreModule, # has to be first!
|
||||||
DataModule,
|
DataModule,
|
||||||
ConfigModule, # has to be before db check
|
|
||||||
DatabaseModule,
|
DatabaseModule,
|
||||||
|
ConfigModule, # has be to after db check
|
||||||
GraphQLModule,
|
GraphQLModule,
|
||||||
PermissionModule,
|
PermissionModule,
|
||||||
AutoRoleModule,
|
AutoRoleModule,
|
||||||
|
@ -4,7 +4,6 @@ import discord
|
|||||||
from cpl_discord.command import DiscordCommandABC
|
from cpl_discord.command import DiscordCommandABC
|
||||||
from cpl_discord.service import DiscordBotServiceABC
|
from cpl_discord.service import DiscordBotServiceABC
|
||||||
from cpl_translation import TranslatePipe
|
from cpl_translation import TranslatePipe
|
||||||
from discord.app_commands import Transform
|
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from discord.ext.commands import Context
|
from discord.ext.commands import Context
|
||||||
|
|
||||||
@ -12,7 +11,6 @@ from bot_core.abc.message_service_abc import MessageServiceABC
|
|||||||
from bot_core.helper.command_checks import CommandChecks
|
from bot_core.helper.command_checks import CommandChecks
|
||||||
from bot_core.logging.command_logger import CommandLogger
|
from bot_core.logging.command_logger import CommandLogger
|
||||||
from bot_core.service.client_utils_service import ClientUtilsService
|
from bot_core.service.client_utils_service import ClientUtilsService
|
||||||
from modules.base.helper.voice_channel_transformer import VoiceChannelTransformer
|
|
||||||
|
|
||||||
|
|
||||||
class MassMoveCommand(DiscordCommandABC):
|
class MassMoveCommand(DiscordCommandABC):
|
||||||
@ -38,7 +36,7 @@ class MassMoveCommand(DiscordCommandABC):
|
|||||||
self,
|
self,
|
||||||
ctx: Context,
|
ctx: Context,
|
||||||
channel_to: discord.VoiceChannel,
|
channel_to: discord.VoiceChannel,
|
||||||
channel_from: Transform[str, VoiceChannelTransformer] = None,
|
channel_from: discord.VoiceChannel = None,
|
||||||
):
|
):
|
||||||
self._logger.debug(__name__, f"Received command mass-move {ctx}")
|
self._logger.debug(__name__, f"Received command mass-move {ctx}")
|
||||||
|
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
import discord
|
|
||||||
from cpl_core.dependency_injection import ServiceProviderABC
|
|
||||||
from cpl_query.extension import List
|
|
||||||
from discord import Interaction, app_commands
|
|
||||||
from discord.app_commands import Transformer, Choice
|
|
||||||
|
|
||||||
from bot_core.abc.client_utils_abc import ClientUtilsABC
|
|
||||||
|
|
||||||
|
|
||||||
class VoiceChannelTransformer(Transformer):
|
|
||||||
async def transform(self, interaction: Interaction, value: str, /) -> discord.VoiceChannel:
|
|
||||||
voice_channel = (
|
|
||||||
List(discord.VoiceChannel, interaction.guild.voice_channels)
|
|
||||||
.where(lambda x: str(x.id) == value)
|
|
||||||
.first_or_default()
|
|
||||||
)
|
|
||||||
return voice_channel
|
|
||||||
|
|
||||||
async def autocomplete(self, interaction: Interaction, current: str, /) -> list[Choice[str]]:
|
|
||||||
@ServiceProviderABC.inject
|
|
||||||
def get_client_utils(client_utils: ClientUtilsABC) -> ClientUtilsABC:
|
|
||||||
return client_utils
|
|
||||||
|
|
||||||
voice_channels = List(discord.Role, interaction.guild.voice_channels).where(lambda x: len(x.members) > 0)
|
|
||||||
return [
|
|
||||||
app_commands.Choice(
|
|
||||||
name=f"{vc.name}" if vc.category is None else f"{vc.name}: {vc.category.name}", value=vc.name
|
|
||||||
)
|
|
||||||
for vc in get_client_utils().get_auto_complete_list(voice_channels, current, lambda x: x.name)
|
|
||||||
]
|
|
Loading…
Reference in New Issue
Block a user