Added logic to count moved users to mass move #156
This commit is contained in:
@@ -10,6 +10,7 @@ from discord.ext.commands import Context
|
||||
from bot_core.abc.message_service_abc import MessageServiceABC
|
||||
from bot_core.helper.command_checks import CommandChecks
|
||||
from bot_core.logging.command_logger import CommandLogger
|
||||
from bot_core.service.client_utils_service import ClientUtilsService
|
||||
|
||||
|
||||
class MassMoveCommand(DiscordCommandABC):
|
||||
@@ -20,12 +21,14 @@ class MassMoveCommand(DiscordCommandABC):
|
||||
message_service: MessageServiceABC,
|
||||
bot: DiscordBotServiceABC,
|
||||
translate: TranslatePipe,
|
||||
client_utils: ClientUtilsService
|
||||
):
|
||||
DiscordCommandABC.__init__(self)
|
||||
self._logger = logger
|
||||
self._message_service = message_service
|
||||
self._bot = bot
|
||||
self._t = translate
|
||||
self._client_utils = client_utils
|
||||
|
||||
@commands.hybrid_command(name='mass-move')
|
||||
@CommandChecks.check_is_ready()
|
||||
@@ -42,7 +45,9 @@ class MassMoveCommand(DiscordCommandABC):
|
||||
channel_from = ctx.author.voice.channel
|
||||
|
||||
moves = [member.move_to(channel_to) for member in channel_from.members]
|
||||
move_count = len(moves)
|
||||
await asyncio.gather(*moves)
|
||||
self._client_utils.moved_users(ctx.guild.id, move_count)
|
||||
|
||||
await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.base.mass_move.moved').format(channel_from.mention, channel_to.mention))
|
||||
|
||||
|
Reference in New Issue
Block a user