Compare commits
	
		
			5 Commits
		
	
	
		
			840da350e4
			...
			91fdf34d32
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 91fdf34d32 | |||
| 12369cdbe3 | |||
| 25c698273a | |||
| 2868b1afe2 | |||
| 0d1c15b31d | 
 Submodule kdb-bot/src/bot/config updated: 52d19fab6d...e7e9d85f7d
									
								
							| @@ -151,6 +151,10 @@ | |||||||
|         }, |         }, | ||||||
|         "footer": "" |         "footer": "" | ||||||
|       }, |       }, | ||||||
|  |       "mass_move": { | ||||||
|  |         "moved": "Alle Personen aus {} wurden nach {} verschoben.", | ||||||
|  |         "channel_from_error": "Du musst dich in einem Voicechannel befinden oder die Option \"channel_from\" mit angeben." | ||||||
|  |       }, | ||||||
|       "presence": { |       "presence": { | ||||||
|         "changed": "Presence wurde geändert.", |         "changed": "Presence wurde geändert.", | ||||||
|         "removed": "Presence wurde entfernt.", |         "removed": "Presence wurde entfernt.", | ||||||
|   | |||||||
| @@ -10,6 +10,7 @@ from modules.base.abc.base_helper_abc import BaseHelperABC | |||||||
| from modules.base.command.afk_command import AFKCommand | from modules.base.command.afk_command import AFKCommand | ||||||
| from modules.base.command.help_command import HelpCommand | from modules.base.command.help_command import HelpCommand | ||||||
| from modules.base.command.info_command import InfoCommand | from modules.base.command.info_command import InfoCommand | ||||||
|  | from modules.base.command.mass_move_command import MassMoveCommand | ||||||
| from modules.base.command.ping_command import PingCommand | from modules.base.command.ping_command import PingCommand | ||||||
| from modules.base.command.presence_command import PresenceCommand | from modules.base.command.presence_command import PresenceCommand | ||||||
| from modules.base.command.purge_command import PurgeCommand | from modules.base.command.purge_command import PurgeCommand | ||||||
| @@ -42,6 +43,7 @@ class BaseModule(ModuleABC): | |||||||
|         self._dc.add_command(AFKCommand) |         self._dc.add_command(AFKCommand) | ||||||
|         self._dc.add_command(HelpCommand) |         self._dc.add_command(HelpCommand) | ||||||
|         self._dc.add_command(InfoCommand) |         self._dc.add_command(InfoCommand) | ||||||
|  |         self._dc.add_command(MassMoveCommand) | ||||||
|         self._dc.add_command(PingCommand) |         self._dc.add_command(PingCommand) | ||||||
|         self._dc.add_command(PresenceCommand) |         self._dc.add_command(PresenceCommand) | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										49
									
								
								kdb-bot/src/modules/base/command/mass_move_command.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								kdb-bot/src/modules/base/command/mass_move_command.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,49 @@ | |||||||
|  | import asyncio | ||||||
|  |  | ||||||
|  | import discord | ||||||
|  | from cpl_discord.command import DiscordCommandABC | ||||||
|  | from cpl_discord.service import DiscordBotServiceABC | ||||||
|  | from cpl_translation import TranslatePipe | ||||||
|  | from discord.ext import commands | ||||||
|  | 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 | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class MassMoveCommand(DiscordCommandABC): | ||||||
|  |  | ||||||
|  |     def __init__( | ||||||
|  |             self, | ||||||
|  |             logger: CommandLogger, | ||||||
|  |             message_service: MessageServiceABC, | ||||||
|  |             bot: DiscordBotServiceABC, | ||||||
|  |             translate: TranslatePipe, | ||||||
|  |     ): | ||||||
|  |         DiscordCommandABC.__init__(self) | ||||||
|  |         self._logger = logger | ||||||
|  |         self._message_service = message_service | ||||||
|  |         self._bot = bot | ||||||
|  |         self._t = translate | ||||||
|  |  | ||||||
|  |     @commands.hybrid_command(name='mass-move') | ||||||
|  |     @CommandChecks.check_is_ready() | ||||||
|  |     @CommandChecks.check_is_member_moderator() | ||||||
|  |     async def mass_move(self, ctx: Context, channel_to: discord.VoiceChannel, | ||||||
|  |                         channel_from: discord.VoiceChannel = None): | ||||||
|  |         self._logger.debug(__name__, f'Received command mass-move {ctx}') | ||||||
|  |  | ||||||
|  |         if channel_from is None and ctx.author.voice is None: | ||||||
|  |             await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.base.mass_move.channel_from_error')) | ||||||
|  |             return | ||||||
|  |  | ||||||
|  |         if channel_from is None: | ||||||
|  |             channel_from = ctx.author.voice.channel | ||||||
|  |  | ||||||
|  |         moves = [member.move_to(channel_to) for member in channel_from.members] | ||||||
|  |         await asyncio.gather(*moves) | ||||||
|  |  | ||||||
|  |         await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.base.mass_move.moved').format(channel_from.mention, channel_to.mention)) | ||||||
|  |  | ||||||
|  |         self._logger.trace(__name__, f'Finished mass-move command') | ||||||
							
								
								
									
										1
									
								
								kdb-bot/src/modules/base/thread/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								kdb-bot/src/modules/base/thread/__init__.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | # imports | ||||||
		Reference in New Issue
	
	Block a user