Example #1
0
 def __init__(self, ins):
     super().__init__(ins)
     self.config_path = CFG_PATH.joinpath("sp_irc.ini")
     if not os.path.exists(self.config_path):
         shutil.copyfile(join_script_path("sp_irc.ini"), self.config_path)
     self.config = ConfigObj(self.config_path, configspec=join_script_path("sp_irc_spec.ini"))
     self.config.validate(Validator(), copy=True)
     self.events = self.config["events"]
     for event in self.events:
         event_manager.register_for_event(event, self.parse_event)
     self.bot.events.ChanMsg += self.irc_message
     self.bot.events.Connected += self.connected
Example #2
0
# ../auth/paths.py

# =============================================================================
# >> IMPORTS
# =============================================================================
# Source.Python imports
from paths import ADDON_PATH as _ADDON_PATH
from paths import CFG_PATH as _CFG_PATH


# =============================================================================
# >> GLOBAL VARIABLES
# =============================================================================
# Store the path to the auth providers
AUTH_PROVIDER_PATH = _ADDON_PATH.joinpath(
    'packages', 'source-python', 'auth', 'providers')

# Store the path to the auth configurations
AUTH_CFG_PATH = _CFG_PATH.joinpath('auth_providers')

# Add all paths to __all__
__all__ = [x for x in globals() if x.isupper() and not x.startswith('_')]
Example #3
0
 def fullpath(self):
     """Return the "path" instance of the full path to the file."""
     return CFG_PATH.joinpath(self.filepath + '.cfg')
Example #4
0
        '''Adds logging settings if they are missing'''

        # Are there any logging settings in the file?
        if not 'LOG_SETTINGS' in self:

            # Add the logging settings
            self['LOG_SETTINGS'] = {}

        # Is there a logging level setting?
        if not 'level' in self['LOG_SETTINGS']:

            # Add the logging level setting
            self['LOG_SETTINGS']['level'] = '0'

        # Set the logging level comments
        self['LOG_SETTINGS'].comments['level'] = _core_strings[
            'log_level'].get_string(self._language).splitlines()

        # Is there a logging areas setting?
        if not 'areas' in self['LOG_SETTINGS']:

            # Add the logging areas setting
            self['LOG_SETTINGS']['areas'] = '1'

        # Set the logging areas comments
        self['LOG_SETTINGS'].comments['areas'] = ['\n\n'] + _core_strings[
            'log_areas'].get_string(self._language).splitlines()

# Get the _CoreSettings instance
_CoreSettingsInstance = _CoreSettings(CFG_PATH.joinpath('core_settings.ini'))
Example #5
0
 def fullpath(self):
     '''Returns the "path" instance of the full path to the file'''
     return CFG_PATH.joinpath(self.filepath + '.cfg')
Example #6
0
# ../auth/paths.py
"""Stores directories used by the auth package."""

# =============================================================================
# >> IMPORTS
# =============================================================================
# Source.Python Imports
#   Paths
from paths import SP_PACKAGES_PATH
from paths import CFG_PATH

# =============================================================================
# >> ALL DECLARATION
# =============================================================================
__all__ = (
    'AUTH_CFG_PATH',
    'AUTH_PROVIDER_PATH',
)

# =============================================================================
# >> GLOBAL VARIABLES
# =============================================================================
# Store the path to the auth providers
AUTH_PROVIDER_PATH = SP_PACKAGES_PATH.joinpath('auth', 'providers')

# Store the path to the auth configurations
AUTH_CFG_PATH = CFG_PATH.joinpath('auth_providers')
Example #7
0
            # Add the private say commands setting
            self['USER_SETTINGS']['private_say_commands'] = ''

        # Set the private say commands comments
        self['USER_SETTINGS'].comments['private_say_commands'] = _core_strings[
            'private_say_commands'].get_string(self._language).splitlines()

        # Is there a public say commands setting?
        if 'public_say_commands' not in self['USER_SETTINGS']:

            # Add the public say commands setting
            self['USER_SETTINGS']['public_say_commands'] = ''

        # Set the public say commands comments
        self['USER_SETTINGS'].comments['public_say_commands'] = _core_strings[
            'public_say_commands'].get_string(self._language).splitlines()

        # Is there a client commands setting?
        if 'client_commands' not in self['USER_SETTINGS']:

            # Add the client commands setting
            self['USER_SETTINGS']['client_commands'] = ''

        # Set the client commands comments
        self['USER_SETTINGS'].comments['client_commands'] = _core_strings[
            'client_commands'].get_string(self._language).splitlines()

# Get the _CoreSettings instance
_core_settings = _CoreSettings(CFG_PATH.joinpath('core_settings.ini'))