Esempio n. 1
0
 def initialize_mumble(md: MumbleData):
     global_settings.mumble_inst = pymumble.Mumble(
         md.ip_address,
         port=md.port,
         user=md.user_id,
         reconnect=md.auto_reconnect,
         password=md.password,
         certfile=md.certificate,
         stereo=md.stereo)
     global_settings.mumble_inst.callbacks.set_callback(
         'text_received', BotService.message_received)
     global_settings.mumble_inst.callbacks.set_callback(
         'sound_received', BotService.sound_received)
     global_settings.mumble_inst.callbacks.set_callback(
         'connected', BotService.on_connected)
     global_settings.mumble_inst.set_codec_profile('audio')
     global_settings.mumble_inst.set_receive_sound(True)
     global_settings.mumble_inst.start()
     global_settings.mumble_inst.is_ready()
     if global_settings.cfg.getboolean(C_CONNECTION_SETTINGS,
                                       P_SELF_REGISTER):
         global_settings.mumble_inst.users.myself.register()
     global_settings.mumble_inst.users.myself.comment(
         f'{runtime_utils.get_comment()}<br>[{META_NAME}({META_VERSION})] - {runtime_utils.get_bot_name()}<br>{runtime_utils.get_about()}'
     )
     runtime_utils.mute()
     runtime_utils.get_channel(global_settings.cfg[C_CONNECTION_SETTINGS]
                               [P_CHANNEL_DEF]).move_in()
Esempio n. 2
0
    def initialize_mumble(self, md: MumbleData):
        global_settings.mumble_inst = pymumble.Mumble(md.ip_address, port=md.port, user=md.user_id,
                                                      reconnect=md.auto_reconnect,
                                                      password=md.password, certfile=md.certificate, stereo=md.stereo)
        # Callback - message_received
        global_settings.mumble_inst.callbacks.set_callback(PYMUMBLE_CLBK_TEXTMESSAGERECEIVED,
                                                           global_settings.clbk_service.message_received)
        global_settings.core_callbacks.append_to_callback(PYMUMBLE_CLBK_TEXTMESSAGERECEIVED, self.message_received)
        # Callback - sound_received
        global_settings.mumble_inst.callbacks.set_callback(PYMUMBLE_CLBK_SOUNDRECEIVED,
                                                           global_settings.clbk_service.sound_received)
        global_settings.core_callbacks.append_to_callback(PYMUMBLE_CLBK_SOUNDRECEIVED, self.sound_received)
        # Callback - on_connected
        global_settings.mumble_inst.callbacks.set_callback(PYMUMBLE_CLBK_CONNECTED,
                                                           global_settings.clbk_service.connected)
        global_settings.core_callbacks.append_to_callback(PYMUMBLE_CLBK_CONNECTED, self.on_connected)
        # Callback - disconnected
        global_settings.mumble_inst.callbacks.set_callback(PYMUMBLE_CLBK_DISCONNECTED,
                                                           global_settings.clbk_service.disconnected)
        global_settings.core_callbacks.append_to_callback(PYMUMBLE_CLBK_DISCONNECTED, self.on_disconnected)
        # Callback - user_created
        global_settings.mumble_inst.callbacks.set_callback(PYMUMBLE_CLBK_USERCREATED,
                                                           global_settings.clbk_service.user_created)
        # Callback - user_updated
        global_settings.mumble_inst.callbacks.set_callback(PYMUMBLE_CLBK_USERUPDATED,
                                                           global_settings.clbk_service.user_updated)
        # Callback - user_removed
        global_settings.mumble_inst.callbacks.set_callback(PYMUMBLE_CLBK_USERREMOVED,
                                                           global_settings.clbk_service.user_removed)
        # Callback - channel_created
        global_settings.mumble_inst.callbacks.set_callback(PYMUMBLE_CLBK_CHANNELCREATED,
                                                           global_settings.clbk_service.channel_created)
        # Callback - channel_removed
        global_settings.mumble_inst.callbacks.set_callback(PYMUMBLE_CLBK_CHANNELREMOVED,
                                                           global_settings.clbk_service.channel_removed)
        # Callback - channel_updated
        global_settings.mumble_inst.callbacks.set_callback(PYMUMBLE_CLBK_CHANNELUPDATED,
                                                           global_settings.clbk_service.channel_updated)
        # Callback - permission_denied
        global_settings.mumble_inst.callbacks.set_callback(PYMUMBLE_CLBK_PERMISSIONDENIED,
                                                           global_settings.clbk_service.permission_denied)

        global_settings.mumble_inst.set_codec_profile('audio')
        global_settings.mumble_inst.set_receive_sound(True)

        try:
            global_settings.mumble_inst.start()
            global_settings.mumble_inst.is_ready()

            if global_settings.cfg.getboolean(C_CONNECTION_SETTINGS, P_SELF_REGISTER, fallback=False):
                global_settings.mumble_inst.users.myself.register()
            global_settings.mumble_inst.users.myself.comment(
                f'{runtime_utils.get_comment()}<br>[{META_NAME}({META_VERSION})] - {runtime_utils.get_bot_name()}<br>{runtime_utils.get_about()}')
            runtime_utils.mute()
            runtime_utils.get_channel(global_settings.cfg[C_CONNECTION_SETTINGS][P_DEFAULT_CHANNEL]).move_in()
        except ConnectionRejectedError as e:
            log(CRITICAL, f"The connection to the server was rejected! {e}",
                origin=L_STARTUP, print_mode=PrintMode.REG_PRINT.value)
            return
Esempio n. 3
0
    def initialize_mumble(self, md: MumbleData):
        global_settings.mumble_inst = pymumble.Mumble(md.ip_address, port=md.port, user=md.user_id,
                                                      reconnect=md.auto_reconnect,
                                                      password=md.password, certfile=md.certificate, stereo=md.stereo)
        # Callback - message_received
        global_settings.mumble_inst.callbacks.set_callback(PYMUMBLE_CLBK_TEXTMESSAGERECEIVED,
                                                           global_settings.clbk_service.message_received)
        global_settings.core_callbacks.append_to_callback(PYMUMBLE_CLBK_TEXTMESSAGERECEIVED, self.message_received)
        # Callback - sound_received
        global_settings.mumble_inst.callbacks.set_callback(PYMUMBLE_CLBK_SOUNDRECEIVED,
                                                           global_settings.clbk_service.sound_received)
        global_settings.core_callbacks.append_to_callback(PYMUMBLE_CLBK_SOUNDRECEIVED, self.sound_received)
        # Callback - on_connected
        global_settings.mumble_inst.callbacks.set_callback(PYMUMBLE_CLBK_CONNECTED,
                                                           global_settings.clbk_service.connected)
        global_settings.core_callbacks.append_to_callback(PYMUMBLE_CLBK_CONNECTED, self.on_connected)
        # Callback - disconnected
        global_settings.mumble_inst.callbacks.set_callback(PYMUMBLE_CLBK_DISCONNECTED,
                                                           global_settings.clbk_service.disconnected)
        # Callback - user_created
        global_settings.mumble_inst.callbacks.set_callback(PYMUMBLE_CLBK_USERCREATED,
                                                           global_settings.clbk_service.user_created)
        # Callback - user_updated
        global_settings.mumble_inst.callbacks.set_callback(PYMUMBLE_CLBK_USERUPDATED,
                                                           global_settings.clbk_service.user_updated)
        # Callback - user_removed
        global_settings.mumble_inst.callbacks.set_callback(PYMUMBLE_CLBK_USERREMOVED,
                                                           global_settings.clbk_service.user_removed)
        # Callback - channel_created
        global_settings.mumble_inst.callbacks.set_callback(PYMUMBLE_CLBK_CHANNELCREATED,
                                                           global_settings.clbk_service.channel_created)
        # Callback - channel_removed
        global_settings.mumble_inst.callbacks.set_callback(PYMUMBLE_CLBK_CHANNELREMOVED,
                                                           global_settings.clbk_service.channel_removed)
        # Callback - channel_updated
        global_settings.mumble_inst.callbacks.set_callback(PYMUMBLE_CLBK_CHANNELUPDATED,
                                                           global_settings.clbk_service.channel_updated)

        global_settings.mumble_inst.set_codec_profile('audio')
        global_settings.mumble_inst.set_receive_sound(True)
        global_settings.mumble_inst.start()
        global_settings.mumble_inst.is_ready()

        if global_settings.cfg.getboolean(C_CONNECTION_SETTINGS, P_SELF_REGISTER, fallback=False):
            global_settings.mumble_inst.users.myself.register()
        global_settings.mumble_inst.users.myself.comment(
            f'{runtime_utils.get_comment()}<br>[{META_NAME}({META_VERSION})] - {runtime_utils.get_bot_name()}<br>{runtime_utils.get_about()}')
        runtime_utils.mute()
        runtime_utils.get_channel(global_settings.cfg[C_CONNECTION_SETTINGS][P_DEFAULT_CHANNEL]).move_in()
 def cmd_move(self, data):
     data_actor = gs.mumble_inst.users[data.actor]['name']
     split_data = data.message.strip().split(' ', 1)
     if len(split_data) != 2:
         rprint(
             f"Incorrect format! Format: {rutils.get_command_token()}move 'channel_name'"
         )
         gs.gui_service.quick_gui(
             f"Incorrect format! Format: {rutils.get_command_token()}move 'channel_name'",
             text_type='header',
             box_align='left',
             user=gs.mumble_inst.users[data.actor]['name'],
             ignore_whisper=True)
         return
     channel_name = split_data[1]
     if channel_name == "default" or channel_name == "Default":
         channel_name = rutils.get_default_channel()
     channel_search = rutils.get_channel(channel_name)
     if channel_search is None:
         return
     channel_search.move_in()
     gs.gui_service.quick_gui(
         f"{rutils.get_bot_name()} was moved by {data_actor}",
         text_type='header',
         box_align='left',
         ignore_whisper=True)
     dprint(f"Moved to channel: {channel_name} by {data_actor}",
            origin=L_COMMAND)
     log(INFO,
         f"Moved to channel: {channel_name} by {data_actor}",
         origin=L_COMMAND)
Esempio n. 5
0
 def cmd_move(self, data):
     data_actor = gs.mumble_inst.users[data.actor]['name']
     split_data = data.message.strip().split(' ', 1)
     if len(split_data) != 2:
         log(ERROR,
             CMD_INVALID_MOVE,
             origin=L_COMMAND,
             error_type=CMD_INVALID_ERR,
             print_mode=PrintMode.VERBOSE_PRINT.value)
         gs.gui_service.quick_gui(
             CMD_INVALID_MOVE,
             text_type='header',
             box_align='left',
             user=gs.mumble_inst.users[data.actor]['name'],
             ignore_whisper=True)
         return
     channel_name = split_data[1].strip()
     if channel_name == "default" or channel_name == "Default":
         channel_name = rutils.get_default_channel()
     channel_search = rutils.get_channel(channel_name)
     if channel_search is None:
         return
     channel_search.move_in()
     gs.gui_service.quick_gui(
         f"{rutils.get_bot_name()} was moved by {data_actor}",
         text_type='header',
         box_align='left',
         ignore_whisper=True)
     log(INFO,
         f"Moved to channel: {channel_name} by {data_actor}",
         origin=L_COMMAND,
         print_mode=PrintMode.VERBOSE_PRINT.value)